Return for mempool transactions coinSpecificData #522
parent
69d13e0688
commit
fc267ed2f4
|
@ -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"`
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
<pre id="txSpecific"></pre>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
txSpecific = {{$tx.CoinSpecificJSON}};
|
||||
txSpecific = {{$tx.CoinSpecificData}};
|
||||
function syntaxHighlight(json) {
|
||||
json = JSON.stringify(json, undefined, 2);
|
||||
json = json.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
||||
|
|
Loading…
Reference in New Issue