Always stem local txs if configured that way (unless explicitly fluffed) (#2876)

* always stem local txs if configured that way (unless explicitly fluff from wallet)
this overrides current epoch behavior for txs coming in via "push-api"
rename "local" to "our" txs

* TxSource is now an enum for type safety.
This commit is contained in:
Antioch Peverell
2019-07-04 11:56:42 +01:00
committed by GitHub
parent 82775164e8
commit f4eb3e3d4b
10 changed files with 86 additions and 75 deletions
+1 -4
View File
@@ -229,10 +229,7 @@ where
}
pub fn test_source() -> TxSource {
TxSource {
debug_name: format!("test"),
identifier: format!("127.0.0.1"),
}
TxSource::Broadcast
}
pub fn clean_output_dir(db_root: String) {
+4 -2
View File
@@ -19,10 +19,12 @@ use self::core::core::{transaction, Block, BlockHeader, Weighting};
use self::core::libtx;
use self::core::pow::Difficulty;
use self::keychain::{ExtKeychain, Keychain};
use self::pool::TxSource;
use self::util::RwLock;
use crate::common::*;
use grin_core as core;
use grin_keychain as keychain;
use grin_pool as pool;
use grin_util as util;
use std::sync::Arc;
@@ -237,7 +239,7 @@ fn test_the_transaction_pool() {
assert_eq!(write_pool.total_size(), 6);
let entry = write_pool.txpool.entries.last().unwrap();
assert_eq!(entry.tx.kernels().len(), 1);
assert_eq!(entry.src.debug_name, "deagg");
assert_eq!(entry.src, TxSource::Deaggregate);
}
// Check we cannot "double spend" an output spent in a previous block.
@@ -447,7 +449,7 @@ fn test_the_transaction_pool() {
assert_eq!(write_pool.total_size(), 6);
let entry = write_pool.txpool.entries.last().unwrap();
assert_eq!(entry.tx.kernels().len(), 1);
assert_eq!(entry.src.debug_name, "deagg");
assert_eq!(entry.src, TxSource::Deaggregate);
}
// Check we cannot "double spend" an output spent in a previous block.