Skip TxIn on coinbase transaction when indexing
This commit is contained in:
parent
b8c3be740f
commit
9780ef5997
1 changed files with 12 additions and 6 deletions
|
@ -160,9 +160,12 @@ func makeBasicFilterForBlock(block *btcutil.Block) ([]byte, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
for _, tx := range block.Transactions() {
|
for i, tx := range block.Transactions() {
|
||||||
for _, txIn := range tx.MsgTx().TxIn {
|
// Skip the inputs for the coinbase transaction
|
||||||
b.AddOutPoint(txIn.PreviousOutPoint)
|
if i != 0 {
|
||||||
|
for _, txIn := range tx.MsgTx().TxIn {
|
||||||
|
b.AddOutPoint(txIn.PreviousOutPoint)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for _, txOut := range tx.MsgTx().TxOut {
|
for _, txOut := range tx.MsgTx().TxOut {
|
||||||
b.AddScript(txOut.PkScript)
|
b.AddScript(txOut.PkScript)
|
||||||
|
@ -183,10 +186,13 @@ func makeExtendedFilterForBlock(block *btcutil.Block) ([]byte, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
for _, tx := range block.Transactions() {
|
for i, tx := range block.Transactions() {
|
||||||
b.AddHash(tx.Hash())
|
b.AddHash(tx.Hash())
|
||||||
for _, txIn := range tx.MsgTx().TxIn {
|
// Skip the inputs for the coinbase transaction
|
||||||
b.AddScript(txIn.SignatureScript)
|
if i != 0 {
|
||||||
|
for _, txIn := range tx.MsgTx().TxIn {
|
||||||
|
b.AddScript(txIn.SignatureScript)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
f, err := b.Build()
|
f, err := b.Build()
|
||||||
|
|
Loading…
Reference in a new issue