Skip to content

Conversation

@natobritto
Copy link
Contributor

When getrawmempool RPC is called with optional verbose argument set to false and subsequent mempool_sequence set to true, a distinct type is returned from v21 onward to v30. This PR implements this return type with corresponding tests.

Partially fixes issue #474.

/// List of transaction ids in the mempool.
pub txids: Vec<Txid>,
/// The mempool sequence value.
pub mempool_sequence: bitcoin::Sequence,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub mempool_sequence: bitcoin::Sequence,
pub mempool_sequence: u64,

bitcoin::Sequence is a transaction input sequence.

/// List of transaction ids in the mempool.
pub txids: Vec<String>,
/// The mempool sequence value.
pub mempool_sequence: u32,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub mempool_sequence: u32,
pub mempool_sequence: u64,

I think a mempool sequence is u64 in Core?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed it is u64 and made the change.

@natobritto natobritto force-pushed the fix-getrawmempool branch 3 times, most recently from 3e8a0b4 to 4928178 Compare January 26, 2026 19:28
jamillambert
jamillambert previously approved these changes Jan 26, 2026
Copy link
Collaborator

@jamillambert jamillambert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 4928178

Comment on lines 212 to 216
// Parse txid strings into `bitcoin::Txid`.
let txids =
self.txids.iter().map(|t: &String| t.parse::<Txid>()).collect::<Result<Vec<_>, _>>()?;

Ok(model::GetRawMempoolSequence { txids, mempool_sequence: self.mempool_sequence })
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be more simply written as

        let txids = self.txids.iter().map(|t| t.parse::<Txid>()).collect::<Result<Vec<_>, _>>()?;
        Ok(model::GetRawMempoolSequence { txids, mempool_sequence: self.mempool_sequence })

Comment on lines 20 to 22
}
pub fn get_raw_mempool_verbose(&self) -> Result<GetRawMempoolVerbose> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: A line of whitespace between the functions here please mate.

Copy link
Member

@tcharding tcharding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything else looks good. Thanks man. Reviewed: 4928178

When getrawmempool is called with verbose set to false and
mempool_sequence set to true, a distinct type is returned.
This commit implements that return type with test, from
version v21 through v30.
Copy link
Collaborator

@jamillambert jamillambert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 7706c36

Copy link
Member

@tcharding tcharding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 7706c36

@tcharding tcharding merged commit 71db6bf into rust-bitcoin:master Jan 30, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants