mirror of
https://github.com/LBRYFoundation/lbcd.git
synced 2025-08-23 17:47:24 +00:00
rpcserver: add txid to getblocktemplate response
This commit is contained in:
parent
40ae93587d
commit
0bf42f4476
2 changed files with 7 additions and 7 deletions
|
@ -236,10 +236,9 @@ type GetBlockFilterResult struct {
|
||||||
// GetBlockTemplateResultTx models the transactions field of the
|
// GetBlockTemplateResultTx models the transactions field of the
|
||||||
// getblocktemplate command.
|
// getblocktemplate command.
|
||||||
type GetBlockTemplateResultTx struct {
|
type GetBlockTemplateResultTx struct {
|
||||||
Data string `json:"data"`
|
Data string `json:"data"`
|
||||||
Hash string `json:"hash"`
|
Hash string `json:"hash"`
|
||||||
// TODO: remove omitempty once implemented in rpcserver
|
TxID string `json:"txid"`
|
||||||
TxID string `json:"txid,omitempty"`
|
|
||||||
Depends []int64 `json:"depends"`
|
Depends []int64 `json:"depends"`
|
||||||
Fee int64 `json:"fee"`
|
Fee int64 `json:"fee"`
|
||||||
SigOps int64 `json:"sigops"`
|
SigOps int64 `json:"sigops"`
|
||||||
|
|
|
@ -1689,8 +1689,8 @@ func (state *gbtWorkState) blockTemplateResult(useCoinbaseValue bool, submitOld
|
||||||
transactions := make([]btcjson.GetBlockTemplateResultTx, 0, numTx-1)
|
transactions := make([]btcjson.GetBlockTemplateResultTx, 0, numTx-1)
|
||||||
txIndex := make(map[chainhash.Hash]int64, numTx)
|
txIndex := make(map[chainhash.Hash]int64, numTx)
|
||||||
for i, tx := range msgBlock.Transactions {
|
for i, tx := range msgBlock.Transactions {
|
||||||
txHash := tx.TxHash()
|
txID := tx.TxHash()
|
||||||
txIndex[txHash] = int64(i)
|
txIndex[txID] = int64(i)
|
||||||
|
|
||||||
// Skip the coinbase transaction.
|
// Skip the coinbase transaction.
|
||||||
if i == 0 {
|
if i == 0 {
|
||||||
|
@ -1724,7 +1724,8 @@ func (state *gbtWorkState) blockTemplateResult(useCoinbaseValue bool, submitOld
|
||||||
bTx := btcutil.NewTx(tx)
|
bTx := btcutil.NewTx(tx)
|
||||||
resultTx := btcjson.GetBlockTemplateResultTx{
|
resultTx := btcjson.GetBlockTemplateResultTx{
|
||||||
Data: hex.EncodeToString(txBuf.Bytes()),
|
Data: hex.EncodeToString(txBuf.Bytes()),
|
||||||
Hash: txHash.String(),
|
TxID: txID.String(),
|
||||||
|
Hash: tx.WitnessHash().String(),
|
||||||
Depends: depends,
|
Depends: depends,
|
||||||
Fee: template.Fees[i],
|
Fee: template.Fees[i],
|
||||||
SigOps: template.SigOpCosts[i],
|
SigOps: template.SigOpCosts[i],
|
||||||
|
|
Loading…
Add table
Reference in a new issue