Set approximate wallet fee to avoid LowFeeTransaction (#163)
Set approximate wallet fee when building a transaction so we avoid getting a LowFeeTransaction error from the pool * rustfmt
This commit is contained in:
committed by
Ignotus Peverell
parent
d0160811dd
commit
dc0dbc62be
+6
-1
@@ -567,6 +567,11 @@ where
|
||||
// TODO evict old/large transactions instead
|
||||
return Err(PoolError::OverCapacity);
|
||||
}
|
||||
|
||||
// for a basic transaction (1 input, 2 outputs) -
|
||||
// (-1 * 1) + (4 * 2) + 1 = 8
|
||||
// 8 * 10 = 80
|
||||
//
|
||||
if self.config.accept_fee_base > 0 {
|
||||
let mut tx_weight = -1 * (tx.inputs.len() as i32) + (4 * tx.outputs.len() as i32) + 1;
|
||||
if tx_weight < 1 {
|
||||
@@ -1055,7 +1060,7 @@ mod tests {
|
||||
|
||||
fn test_setup(dummy_chain: &Arc<DummyChainImpl>) -> TransactionPool<DummyChainImpl> {
|
||||
TransactionPool {
|
||||
config: PoolConfig{
|
||||
config: PoolConfig {
|
||||
accept_fee_base: 0,
|
||||
max_pool_size: 10_000,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user