WIP: Feature/6/jeffreypicard/dockerize for deployment #7

Closed
jeffreypicard wants to merge 80 commits from feature/6/jeffreypicard/dockerize-for-deployment into master
Showing only changes of commit f780a6086f - Show all commits

View file

@ -14,6 +14,7 @@ import (
"github.com/btcsuite/btcd/blockchain" "github.com/btcsuite/btcd/blockchain"
"github.com/btcsuite/btcd/chaincfg" "github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcd/chaincfg/chainhash" "github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/mining"
"github.com/btcsuite/btcd/txscript" "github.com/btcsuite/btcd/txscript"
"github.com/btcsuite/btcd/wire" "github.com/btcsuite/btcd/wire"
"github.com/btcsuite/btcutil" "github.com/btcsuite/btcutil"
@ -181,6 +182,21 @@ func CreateBlock(prevBlock *btcutil.Block, inclusionTxs []*btcutil.Tx,
if inclusionTxs != nil { if inclusionTxs != nil {
blockTxns = append(blockTxns, inclusionTxs...) blockTxns = append(blockTxns, inclusionTxs...)
} }
// We must add the witness commitment to the coinbase if any
// transactions are segwit.
witnessIncluded := false
for i := 1; i < len(blockTxns); i++ {
if blockTxns[i].MsgTx().HasWitness() {
witnessIncluded = true
break
}
}
if witnessIncluded {
_ = mining.AddWitnessCommitment(coinbaseTx, blockTxns)
}
merkles := blockchain.BuildMerkleTreeStore(blockTxns, false) merkles := blockchain.BuildMerkleTreeStore(blockTxns, false)
var block wire.MsgBlock var block wire.MsgBlock
block.Header = wire.BlockHeader{ block.Header = wire.BlockHeader{