Skip to content

Commit

Permalink
Fix GetMempoolTx bug returning no entries
Browse files Browse the repository at this point in the history
This was broken by PR 393, which changed how txids are determined.
  • Loading branch information
Larry Ruane authored and LarryRuane committed Jul 21, 2022
1 parent db2795a commit af0f348
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 0 additions & 4 deletions common/mempool.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ func GetMempool(sendToClient func(*walletrpc.RawTransaction) error) error {
if g_lastBlockChainInfo.BestBlockHash != blockChainInfo.BestBlockHash {
// A new block has arrived
g_lastBlockChainInfo = blockChainInfo
Log.Infoln("Latest Block changed, clearing everything")
// We're the first thread to notice, clear cached state.
g_txidSeen = map[txid]struct{}{}
g_txList = []*walletrpc.RawTransaction{}
Expand Down Expand Up @@ -89,8 +88,6 @@ func GetMempool(sendToClient func(*walletrpc.RawTransaction) error) error {

// RefreshMempoolTxns gets all new mempool txns and sends any new ones to waiting clients
func refreshMempoolTxns() error {
Log.Infoln("Refreshing mempool")

params := []json.RawMessage{}
result, rpcErr := RawRequest("getrawmempool", params)
if rpcErr != nil {
Expand Down Expand Up @@ -132,7 +129,6 @@ func refreshMempoolTxns() error {
if err != nil {
return err
}
Log.Infoln("appending", txidstr)
newRtx := &walletrpc.RawTransaction{
Data: txBytes,
Height: uint64(g_lastBlockChainInfo.Blocks),
Expand Down
5 changes: 5 additions & 0 deletions frontend/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,11 @@ func (s *lwdStreamer) GetMempoolTx(exclude *walletrpc.Exclude, resp walletrpc.Co
}
newmempoolMap[txidstr] = &walletrpc.CompactTx{}
if tx.HasShieldedElements() {
txidBytes, err := hex.DecodeString(txidstr)
if err != nil {
return err
}
tx.SetTxID(txidBytes)
newmempoolMap[txidstr] = tx.ToCompact( /* height */ 0)
}
}
Expand Down

0 comments on commit af0f348

Please sign in to comment.