Interpret btcd:blockconnected hash as string.
btcd was changed to send the block hash for new block notifications as a big endian string, so type assert as a string and convert to a btcwire.ShaHash.
This commit is contained in:
parent
79d1491ac4
commit
6e20de7c4a
1 changed files with 7 additions and 2 deletions
|
@ -268,11 +268,16 @@ func ProcessBtcdNotificationReply(b []byte) {
|
|||
switch idStr {
|
||||
case "btcd:blockconnected":
|
||||
result := m["result"].(map[string]interface{})
|
||||
hash := new(btcwire.ShaHash)
|
||||
copy(hash[:], UnmangleJsonByteSlice(result["hash"].([]interface{})))
|
||||
hashBE := m["hash"].(string)
|
||||
hash, err := btcwire.NewShaHashFromStr(hashBE)
|
||||
if err != nil {
|
||||
log.Error("btcd:blockconnected handler: Invalid hash string")
|
||||
return
|
||||
}
|
||||
height := int64(result["height"].(float64))
|
||||
|
||||
// TODO(jrick): update TxStore and UtxoStore with new hash
|
||||
_ = hash
|
||||
var id interface{} = "btcwallet:newblockchainheight"
|
||||
msgRaw := &btcjson.Reply{
|
||||
Result: height,
|
||||
|
|
Loading…
Reference in a new issue