Fix bug in blockconnected notification handler.

If the new minedtx field cannot by type asserted as a []string, keep
processing the notification instead of printing an error and
returning.
This commit is contained in:
Josh Rickmar 2013-10-23 21:04:25 -04:00
parent 4b7f858bee
commit b8d7620ced

View file

@ -344,19 +344,17 @@ func NtfnBlockConnected(r interface{}) {
return
}
height := int64(heightf)
iminedTxs, ok := result["minedtxs"].([]interface{})
if !ok {
log.Error("blockconnected notification: invalid mined tx array")
return
}
minedTxs := make([]string, len(iminedTxs))
for i, iminedTx := range iminedTxs {
minedTx, ok := iminedTx.(string)
if !ok {
log.Error("blockconnected notification: mined tx is not a string")
continue
var minedTxs []string
if iminedTxs, ok := result["minedtxs"].([]interface{}); ok {
minedTxs = make([]string, len(iminedTxs))
for i, iminedTx := range iminedTxs {
minedTx, ok := iminedTx.(string)
if !ok {
log.Error("blockconnected notification: mined tx is not a string")
continue
}
minedTxs[i] = minedTx
}
minedTxs[i] = minedTx
}
curHeight.Lock()