oh right, another fun thing I forgot about

When there's only the coinbase tx, the merkle root = the coinbase txid.
Needless complication in bitcoin == job security?
This commit is contained in:
Tadge Dryja 2016-01-19 10:59:13 -08:00
parent 7dbf4a4a4f
commit 709b8a05cd
2 changed files with 3 additions and 3 deletions

@ -77,9 +77,6 @@ func checkMBlock(m *wire.MsgMerkleBlock) ([]*wire.ShaHash, error) {
if len(m.Flags) == 0 { if len(m.Flags) == 0 {
return nil, fmt.Errorf("No flag bits") return nil, fmt.Errorf("No flag bits")
} }
if len(m.Hashes) < 2 { // nothing but the merkle root
return nil, nil // nothin.
}
var s []merkleNode // the stack var s []merkleNode // the stack
var r []*wire.ShaHash // slice to return; txids we care about var r []*wire.ShaHash // slice to return; txids we care about

@ -5,6 +5,8 @@ import (
"fmt" "fmt"
"log" "log"
"li.lan/labs/uwallet"
"github.com/btcsuite/btcd/wire" "github.com/btcsuite/btcd/wire"
"github.com/btcsuite/btcutil" "github.com/btcsuite/btcutil"
"github.com/btcsuite/btcutil/bloom" "github.com/btcsuite/btcutil/bloom"
@ -72,6 +74,7 @@ func (t *TxStore) IngestTx(tx *wire.MsgTx) error {
inTxid := tx.TxSha() inTxid := tx.TxSha()
height, ok := t.OKTxids[inTxid] height, ok := t.OKTxids[inTxid]
if !ok { if !ok {
log.Printf("False postive tx? %s", uwallet.TxToString(tx))
return fmt.Errorf("we don't care about tx %s", inTxid.String()) return fmt.Errorf("we don't care about tx %s", inTxid.String())
} }