struct OutputLocker {
/// The Hash of 'Pay-to-Public-Key-Hash'.
p2pkh: Hash,
/// The 'R' for ephemeral key: `q = Hash(secured_w || p*R)`.
pub_nonce: PublicKey,
/// The secured version of 'w' for the Pedersen commitment: `C = q*G + w*H`,
/// the real 'w' can be calculated by: `w = secured_w XOR q[0..8]`.
secured_w: u64,
/// The relative lock height, after which the output can be spent.
relative_lock_height: u32,
}
The new structure:
pub struct OutputLocker {
/// The Blake2b hash of 'Pay-to-Public-Key-Hash'.
pub p2pkh: Hash,
/// The 'R' for ephemeral key: `q = Hash(secured_w || p*R)`.
pub pub_nonce: PublicKey,
/// A secured path message which hide the key derivation path and the random w of commitment.
pub spath: SecuredPath,
}
The PathMessage structure:
pub struct PathMessage {
/// The random 'w' of Pedersen commitment `r*G + w*H`
pub w: i64,
/// The last path index of the key identifier
pub key_id_last_path: u32,
}
Regarding the relative_lock_height:
relative_lock_height is removed and take it always as value 1.
relative_lock_height 's 4-byte is replaced by key_id_last_path which is part of the PathMessage structure.
This refactoring is making the code more simple and better readable, and the new key_id_last_path will be helpful for wallet to check/restore all non-interactive outputs under one wallet account.
Refactoring the
OutputLocker
structure.The original structure:
The new structure:
The
PathMessage
structure:Regarding the
relative_lock_height
:relative_lock_height
is removed and take it always as value1
.relative_lock_height
's 4-byte is replaced bykey_id_last_path
which is part of thePathMessage
structure.This refactoring is making the code more simple and better readable, and the new
key_id_last_path
will be helpful for wallet to check/restore all non-interactive outputs under one wallet account.