-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
prepare_sign
method to transaction (#9)
* Add `prepare_sign` method to transaction The transaction to be signed have some fields zeroed as in the specs. This commit facilitates the bytes manipulation of a serialized transaction so they can be zeroed with no hardcoded positions. With the `prepare_sign` function, it is trivial to add `id` considering some generic hash function - currently defined as Sha256. * Change input offset to target predicate The latest spec points the execution of a predicate verification is over the predicate bytes and not the predicate data of the Input::Coin instances of the transaction
- Loading branch information
Showing
16 changed files
with
526 additions
and
151 deletions.
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
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
use crate::Hash; | ||
use sha2::{Digest, Sha256}; | ||
|
||
pub fn hash(data: &[u8]) -> Hash { | ||
let mut hasher = Sha256::new(); | ||
hasher.update(data); | ||
hasher.finalize().into() | ||
} |
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
Oops, something went wrong.