mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: track encoded length with pooled txs (#4976)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@ -20,7 +20,13 @@ fn decode_pooled_transactions_data() {
|
||||
}
|
||||
|
||||
// now do another decoding, on what we encoded - this should succeed
|
||||
let _txs2 = PooledTransactions::decode(&mut &buf[..]).unwrap();
|
||||
let txs2 = PooledTransactions::decode(&mut &buf[..]).unwrap();
|
||||
|
||||
// ensure that the payload length is the same
|
||||
assert_eq!(txs.length(), txs2.length());
|
||||
|
||||
// ensure that the length is equal to the length of the encoded data
|
||||
assert_eq!(txs.length(), buf.len());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@ -845,7 +845,7 @@ impl PropagateTransaction {
|
||||
|
||||
/// Create a new instance from a pooled transaction
|
||||
fn new<T: PoolTransaction>(tx: Arc<ValidPoolTransaction<T>>) -> Self {
|
||||
let size = tx.encoded_length;
|
||||
let size = tx.encoded_length();
|
||||
let transaction = Arc::new(tx.transaction.to_recovered_transaction().into_signed());
|
||||
Self { size, transaction }
|
||||
}
|
||||
@ -900,7 +900,7 @@ impl PooledTransactionsHashesBuilder {
|
||||
PooledTransactionsHashesBuilder::Eth66(msg) => msg.0.push(*pooled_tx.hash()),
|
||||
PooledTransactionsHashesBuilder::Eth68(msg) => {
|
||||
msg.hashes.push(*pooled_tx.hash());
|
||||
msg.sizes.push(pooled_tx.encoded_length);
|
||||
msg.sizes.push(pooled_tx.encoded_length());
|
||||
msg.types.push(pooled_tx.transaction.tx_type());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user