-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
40c1d37
commit d8202d4
Showing
4 changed files
with
118 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
# bitcoin-simulator | ||
A simulator of a local bitcoin testnet based on Rust and Sqlite. | ||
|
||
A simulator of a local Bitcoin ledger based on Rust and Sqlite. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,6 @@ pub mod database; | |
|
||
pub mod spending_requirements; | ||
|
||
pub mod policy; | ||
|
||
define_pushable!(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
pub struct Policy { | ||
pub sat_per_vbyte: u32, | ||
pub allow_data_carrier_via_op_return: bool, | ||
pub require_dust_amount: bool, | ||
pub max_tx_weight: u32, | ||
} | ||
|
||
impl Default for Policy { | ||
fn default() -> Self { | ||
Self { | ||
sat_per_vbyte: 1, | ||
allow_data_carrier_via_op_return: false, /* subject to many spam filters */ | ||
require_dust_amount: true, | ||
max_tx_weight: 400000, | ||
} | ||
} | ||
} | ||
|
||
impl Policy { | ||
pub fn no_spam_filter(mut self) -> Self { | ||
self.allow_data_carrier_via_op_return = true; | ||
self | ||
} | ||
|
||
pub fn no_dust_amount_requirement(mut self) -> Self { | ||
self.require_dust_amount = false; | ||
self | ||
} | ||
|
||
pub fn set_fee(mut self, sat_per_vbyte: u32) -> Self { | ||
self.sat_per_vbyte = sat_per_vbyte; | ||
self | ||
} | ||
|
||
pub fn set_max_tx_weight(mut self, max_tx_weight: u32) -> Self { | ||
self.max_tx_weight = max_tx_weight; | ||
self | ||
} | ||
} |