diff --git a/btcjson/chainsvrresults.go b/btcjson/chainsvrresults.go index 9cafe334..aeb1f6ac 100644 --- a/btcjson/chainsvrresults.go +++ b/btcjson/chainsvrresults.go @@ -236,10 +236,9 @@ type GetBlockFilterResult struct { // GetBlockTemplateResultTx models the transactions field of the // getblocktemplate command. type GetBlockTemplateResultTx struct { - Data string `json:"data"` - Hash string `json:"hash"` - // TODO: remove omitempty once implemented in rpcserver - TxID string `json:"txid,omitempty"` + Data string `json:"data"` + Hash string `json:"hash"` + TxID string `json:"txid"` Depends []int64 `json:"depends"` Fee int64 `json:"fee"` SigOps int64 `json:"sigops"` diff --git a/rpcserver.go b/rpcserver.go index d7b68bf8..9a52301e 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -1689,8 +1689,8 @@ func (state *gbtWorkState) blockTemplateResult(useCoinbaseValue bool, submitOld transactions := make([]btcjson.GetBlockTemplateResultTx, 0, numTx-1) txIndex := make(map[chainhash.Hash]int64, numTx) for i, tx := range msgBlock.Transactions { - txHash := tx.TxHash() - txIndex[txHash] = int64(i) + txID := tx.TxHash() + txIndex[txID] = int64(i) // Skip the coinbase transaction. if i == 0 { @@ -1724,7 +1724,8 @@ func (state *gbtWorkState) blockTemplateResult(useCoinbaseValue bool, submitOld bTx := btcutil.NewTx(tx) resultTx := btcjson.GetBlockTemplateResultTx{ Data: hex.EncodeToString(txBuf.Bytes()), - Hash: txHash.String(), + TxID: txID.String(), + Hash: tx.WitnessHash().String(), Depends: depends, Fee: template.Fees[i], SigOps: template.SigOpCosts[i],