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 {
|
switch idStr {
|
||||||
case "btcd:blockconnected":
|
case "btcd:blockconnected":
|
||||||
result := m["result"].(map[string]interface{})
|
result := m["result"].(map[string]interface{})
|
||||||
hash := new(btcwire.ShaHash)
|
hashBE := m["hash"].(string)
|
||||||
copy(hash[:], UnmangleJsonByteSlice(result["hash"].([]interface{})))
|
hash, err := btcwire.NewShaHashFromStr(hashBE)
|
||||||
|
if err != nil {
|
||||||
|
log.Error("btcd:blockconnected handler: Invalid hash string")
|
||||||
|
return
|
||||||
|
}
|
||||||
height := int64(result["height"].(float64))
|
height := int64(result["height"].(float64))
|
||||||
|
|
||||||
// TODO(jrick): update TxStore and UtxoStore with new hash
|
// TODO(jrick): update TxStore and UtxoStore with new hash
|
||||||
|
_ = hash
|
||||||
var id interface{} = "btcwallet:newblockchainheight"
|
var id interface{} = "btcwallet:newblockchainheight"
|
||||||
msgRaw := &btcjson.Reply{
|
msgRaw := &btcjson.Reply{
|
||||||
Result: height,
|
Result: height,
|
||||||
|
|
Loading…
Reference in a new issue