Minimal Transaction Pool (#1067)

* verify a tx like we verify a block (experimental)

* first minimal_pool test up and running but not testing what we need to

* rework tx_pool validation to use txhashset extension

* minimal tx pool wired up but rough

* works locally (rough statew though)
delete "legacy" pool and graph code

* rework the new pool into TransactionPool and Pool impls

* rework pool to store pool entries
with associated timer and source etc.

* all_transactions

* extra_txs so we can validate stempool against existing txpool

* rework reconcile_block

* txhashset apply_raw_tx can now rewind to a checkpoint (prev raw tx)

* wip - txhashset tx tests

* more flexible rewind on MMRs

* add tests to cover apply_raw_txs on txhashset extension

* add_to_stempool and add_to_txpool

* deaggregate multi kernel tx when adding to txpoool

* handle freshness in stempool
handle propagation of stempool txs via dandelion monitor

* patience timer and fluff if we cannot propagate
to next relay

* aggregate and fluff stempool is we have no relay

* refactor coinbase maturity

* rewrote basic tx pool tests to use a real txhashset via chain adapter

* rework dandelion monitor to reflect recent discussion
works locally but needs a cleanup

* refactor dandelion_monitor - split out phases

* more pool test coverage

* remove old test code from pool (still wip)

* block_building and block_reconciliation tests

* tracked down chain test failure...

* fix test_coinbase_maturity

* dandelion_monitor now runs...

* refactor dandelion config, shared across p2p and pool components

* fix pool tests with new config

* fix p2p tests

* rework tx pool to deal with duplicate commitments (testnet2 limitation)

* cleanup and address some PR feedback

* add big comment about pre_tx...
This commit is contained in:
Antioch Peverell
2018-05-30 16:57:13 -04:00
committed by GitHub
parent b6c31ebc78
commit 4fda7a6899
61 changed files with 2265 additions and 3569 deletions
+2 -2
View File
@@ -16,15 +16,15 @@
//! the wallet storage and update them.
use failure::ResultExt;
use std::collections::HashMap;
use std::collections::hash_map::Entry;
use std::collections::HashMap;
use api;
use keychain::Identifier;
use libwallet::types::*;
use util;
use util::LOGGER;
use util::secp::pedersen;
use util::LOGGER;
pub fn refresh_outputs<T>(wallet: &mut T) -> Result<(), Error>
where
+2 -2
View File
@@ -18,13 +18,13 @@ use std::cmp::min;
use std::collections::HashMap;
use std::fs::{self, File};
use std::io::{Read, Write};
use std::path::MAIN_SEPARATOR;
use std::path::Path;
use std::path::MAIN_SEPARATOR;
use serde_json;
use tokio_core::reactor;
use tokio_retry::Retry;
use tokio_retry::strategy::FibonacciBackoff;
use tokio_retry::Retry;
use failure::{Fail, ResultExt};
+1 -1
View File
@@ -14,9 +14,9 @@
use std::sync::{Arc, RwLock};
use bodyparser;
use iron::Handler;
use iron::prelude::*;
use iron::status;
use iron::Handler;
use serde_json;
use core::ser;
+1 -1
View File
@@ -13,9 +13,9 @@
// limitations under the License.
//! Aggsig helper functions used in transaction creation.. should be only
//! interface into the underlying secp library
use keychain::Keychain;
use keychain::blind::BlindingFactor;
use keychain::extkey::Identifier;
use keychain::Keychain;
use libtx::error::Error;
use util::kernel_sig_msg;
use util::secp::key::{PublicKey, SecretKey};
+1 -1
View File
@@ -15,8 +15,8 @@
//! Rangeproof library functions
use blake2;
use keychain::Keychain;
use keychain::extkey::Identifier;
use keychain::Keychain;
use libtx::error::Error;
use util::logger::LOGGER;
use util::secp::key::SecretKey;
+1 -1
View File
@@ -22,8 +22,8 @@ use keychain::{BlindSum, BlindingFactor, Keychain};
use libtx::error::Error;
use libtx::{aggsig, build, tx_fee};
use util::secp::Signature;
use util::secp::key::{PublicKey, SecretKey};
use util::secp::Signature;
use util::{secp, LOGGER};
/// Public data for each participant in the slate
+1 -1
View File
@@ -16,7 +16,7 @@
use failure::ResultExt;
use keychain::Identifier;
use libtx::{build, tx_fee, slate::Slate};
use libtx::{build, slate::Slate, tx_fee};
use libwallet::types::*;
use libwallet::{keys, sigcontext};
+5 -2
View File
@@ -357,8 +357,11 @@ pub enum ErrorKind {
#[fail(display = "Fee dispute: sender fee {}, recipient fee {}", sender_fee, recipient_fee)]
FeeDispute { sender_fee: u64, recipient_fee: u64 },
#[fail(display = "Fee exceeds amount: sender amount {}, recipient fee {}", sender_amount,
recipient_fee)]
#[fail(
display = "Fee exceeds amount: sender amount {}, recipient fee {}",
sender_amount,
recipient_fee
)]
FeeExceedsAmount {
sender_amount: u64,
recipient_fee: u64,
+1 -1
View File
@@ -19,9 +19,9 @@
use std::sync::{Arc, RwLock};
use bodyparser;
use iron::Handler;
use iron::prelude::*;
use iron::status;
use iron::Handler;
use serde_json;
use api;
+1 -1
View File
@@ -20,8 +20,8 @@ use keychain::Identifier;
use libtx::proof;
use libwallet::types::*;
use util;
use util::LOGGER;
use util::secp::pedersen;
use util::LOGGER;
pub fn get_chain_height(node_addr: &str) -> Result<u64, Error> {
let url = format!("{}/v1/chain", node_addr);