Wallet operation to burn some coins (#172)

* Burn transaction for testing
* Burn bug fixes, embed burn key in keychain
* Better error logging in API, wallet fee calc fix
This commit is contained in:
Ignotus Peverell
2017-10-12 03:35:40 +00:00
committed by GitHub
parent bf7c1fb44f
commit b85006ebe5
9 changed files with 158 additions and 49 deletions
+18 -1
View File
@@ -200,6 +200,14 @@ fn main() {
.long("dest")
.takes_value(true)))
.subcommand(SubCommand::with_name("burn")
.about("** TESTING ONLY ** Burns the provided amount to a known \
key. Similar to send but burns an output to allow single-party \
transactions.")
.arg(Arg::with_name("amount")
.help("Amount to burn in the smallest denomination")
.index(1)))
.subcommand(SubCommand::with_name("info")
.about("basic wallet info (outputs)")))
@@ -313,7 +321,7 @@ fn wallet_command(wallet_args: &ArgMatches) {
// TODO do something closer to BIP39, eazy solution right now
let seed = blake2::blake2b::blake2b(32, &[], hd_seed.as_bytes());
let keychain = Keychain::from_seed(seed.as_bytes()).expect(
let mut keychain = Keychain::from_seed(seed.as_bytes()).expect(
"Failed to initialize keychain from the provided seed.",
);
@@ -371,6 +379,15 @@ fn wallet_command(wallet_args: &ArgMatches) {
}
wallet::issue_send_tx(&wallet_config, &keychain, amount, dest.to_string()).unwrap();
}
("burn", Some(send_args)) => {
let amount = send_args
.value_of("amount")
.expect("Amount to burn required")
.parse()
.expect("Could not parse amount as a whole number.");
keychain.enable_burn_key = true;
wallet::issue_burn_tx(&wallet_config, &keychain, amount).unwrap();
}
("info", Some(_)) => {
wallet::show_info(&wallet_config, &keychain);
}