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
+7 -3
View File
@@ -135,6 +135,12 @@ impl Identifier {
Identifier(identifier)
}
pub fn from_pubkey(secp: &Secp256k1, pubkey: &PublicKey) -> Identifier {
let bytes = pubkey.serialize_vec(secp, true);
let identifier = blake2b(20, &[], &bytes[..]);
Identifier::from_bytes(&identifier.as_bytes())
}
fn from_hex(hex: &str) -> Result<Identifier, Error> {
// TODO - error handling, don't unwrap here
let bytes = util::from_hex(hex.to_string()).unwrap();
@@ -245,9 +251,7 @@ impl ExtendedKey {
// corresponding to the underlying SecretKey
pub fn identifier(&self, secp: &Secp256k1) -> Result<Identifier, Error> {
let pubkey = PublicKey::from_secret_key(secp, &self.key)?;
let bytes = pubkey.serialize_vec(secp, true);
let identifier = blake2b(20, &[], &bytes[..]);
Ok(Identifier::from_bytes(&identifier.as_bytes()))
Ok(Identifier::from_pubkey(secp, &pubkey))
}
/// Derive an extended key from an extended key