diff --git a/api/types.go b/api/types.go index b8fa5579..38f0fd87 100644 --- a/api/types.go +++ b/api/types.go @@ -196,8 +196,7 @@ type Tx struct { FeesSat *Amount `json:"fees,omitempty"` Hex string `json:"hex,omitempty"` Rbf bool `json:"rbf,omitempty"` - CoinSpecificData interface{} `json:"-"` - CoinSpecificJSON json.RawMessage `json:"-"` + CoinSpecificData json.RawMessage `json:"coinSpecificData,omitempty"` TokenTransfers []TokenTransfer `json:"tokenTransfers,omitempty"` EthereumSpecific *EthereumSpecific `json:"ethereumSpecific,omitempty"` } diff --git a/api/worker.go b/api/worker.go index 87b9cfe0..63b5dc74 100644 --- a/api/worker.go +++ b/api/worker.go @@ -274,7 +274,8 @@ func (w *Worker) GetTransactionFromBchainTx(bchainTx *bchain.Tx, height int, spe // for now do not return size, we would have to compute vsize of segwit transactions // size:=len(bchainTx.Hex) / 2 var sj json.RawMessage - if specificJSON { + // return CoinSpecificData for all mempool transactions or if requested + if specificJSON || bchainTx.Confirmations == 0 { sj, err = w.chain.GetTransactionSpecific(bchainTx) if err != nil { return nil, err @@ -299,8 +300,7 @@ func (w *Worker) GetTransactionFromBchainTx(bchainTx *bchain.Tx, height int, spe Rbf: rbf, Vin: vins, Vout: vouts, - CoinSpecificData: bchainTx.CoinSpecificData, - CoinSpecificJSON: sj, + CoinSpecificData: sj, TokenTransfers: tokens, EthereumSpecific: ethSpecific, } @@ -758,7 +758,7 @@ func (w *Worker) txFromTxid(txid string, bestheight uint32, option AccountDetail if ta == nil { glog.Warning("DB inconsistency: tx ", txid, ": not found in txAddresses") // as fallback, get tx from backend - tx, err = w.GetTransaction(txid, false, true) + tx, err = w.GetTransaction(txid, false, false) if err != nil { return nil, errors.Annotatef(err, "GetTransaction %v", txid) } @@ -777,7 +777,7 @@ func (w *Worker) txFromTxid(txid string, bestheight uint32, option AccountDetail tx = w.txFromTxAddress(txid, ta, blockInfo, bestheight) } } else { - tx, err = w.GetTransaction(txid, false, true) + tx, err = w.GetTransaction(txid, false, false) if err != nil { return nil, errors.Annotatef(err, "GetTransaction %v", txid) } @@ -866,7 +866,7 @@ func (w *Worker) GetAddress(address string, page int, txsOnPage int, option Acco return nil, errors.Annotatef(err, "getAddressTxids %v true", addrDesc) } for _, txid := range txm { - tx, err := w.GetTransaction(txid, false, false) + tx, err := w.GetTransaction(txid, false, true) // mempool transaction may fail if err != nil || tx == nil { glog.Warning("GetTransaction in mempool: ", err) diff --git a/api/xpub.go b/api/xpub.go index 8b1cdc58..843249fa 100644 --- a/api/xpub.go +++ b/api/xpub.go @@ -416,7 +416,7 @@ func (w *Worker) GetXpubAddress(xpub string, page int, txsOnPage int, option Acc // the same tx can have multiple addresses from the same xpub, get it from backend it only once tx, foundTx := txmMap[txid.txid] if !foundTx { - tx, err = w.GetTransaction(txid.txid, false, false) + tx, err = w.GetTransaction(txid.txid, false, true) // mempool transaction may fail if err != nil || tx == nil { glog.Warning("GetTransaction in mempool: ", err) diff --git a/static/templates/tx.html b/static/templates/tx.html index ee4279f1..7257ebcb 100644 --- a/static/templates/tx.html +++ b/static/templates/tx.html @@ -78,7 +78,7 @@