Skip to content

Commit 169e75a

Browse files
committed
Merge branch 'Hotfix2'
2 parents f2fa9e8 + 58fde54 commit 169e75a

File tree

3 files changed

+30
-3
lines changed

3 files changed

+30
-3
lines changed

all.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ checkout btclog $branch $default
120120
checkout dynrsrc $branch $default
121121
checkout ed25519 $branch $default
122122
checkout fastsha256 $branch $default
123+
checkout go-bip32 $branch $default
124+
checkout go-bip39 $branch $default
123125
checkout go-flags $branch $default
124126
checkout go-socks $branch $default
125127
checkout seelog $branch $default

common/constants.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const (
3232
// maxProtocolVersion is the max protocol version the peer supports.
3333
//Common constants
3434
VERSION_0 = byte(0)
35-
FACTOMD_VERSION = 3002 //fixed point. resolves to 0.<thousands place>.<rightmost digits>
35+
FACTOMD_VERSION = 3003 //fixed point. resolves to 0.<thousands place>.<rightmost digits>
3636
NETWORK_ID_DB = uint32(4203931041) //0xFA92E5A1
3737
NETWORK_ID_EB = uint32(4203931042) //0xFA92E5A2
3838
NETWORK_ID_CB = uint32(4203931043) //0xFA92E5A3

wsapi/wsapi.go

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ func Start(db database.Db, inMsgQ chan wire.FtmInternalMsg) {
5656
server.Get("/v1/directory-block-head/?", handleDirectoryBlockHead)
5757
server.Get("/v1/get-raw-data/([^/]+)", handleGetRaw)
5858
server.Get("/v1/directory-block-by-keymr/([^/]+)", handleDirectoryBlock)
59+
server.Get("/v1/directory-block-height/?", handleDirectoryBlockHeight)
5960
server.Get("/v1/entry-block-by-keymr/([^/]+)", handleEntryBlock)
6061
server.Get("/v1/entry-by-hash/([^/]+)", handleEntry)
6162
server.Get("/v1/chain-head/([^/]+)", handleChainHead)
@@ -250,8 +251,32 @@ func handleDirectoryBlockHead(ctx *web.Context) {
250251
} else {
251252
ctx.Write(p)
252253
}
254+
}
253255

254-
// ctx.WriteHeader(httpOK)
256+
257+
func handleDirectoryBlockHeight(ctx *web.Context) {
258+
type dbheight struct {
259+
Height int
260+
}
261+
262+
h := new(dbheight)
263+
if block, err := factomapi.DBlockHead(); err != nil {
264+
wsLog.Error(err)
265+
ctx.WriteHeader(httpBad)
266+
ctx.Write([]byte(err.Error()))
267+
return
268+
} else {
269+
h.Height = int(block.Header.DBHeight)
270+
}
271+
272+
if p, err := json.Marshal(h); err != nil {
273+
wsLog.Error(err)
274+
ctx.WriteHeader(httpBad)
275+
ctx.Write([]byte(err.Error()))
276+
return
277+
} else {
278+
ctx.Write(p)
279+
}
255280
}
256281

257282
func handleDirectoryBlock(ctx *web.Context, keymr string) {
@@ -519,7 +544,7 @@ func handleFactoidSubmit(ctx *web.Context) {
519544
}
520545

521546
msg := new(wire.MsgFactoidTX)
522-
547+
fmt.Println(string(p))
523548
if p, err = hex.DecodeString(t.Transaction); err != nil {
524549
returnMsg(ctx, "Unable to decode the transaction", false)
525550
return

0 commit comments

Comments
 (0)