Skip to content

Commit

Permalink
Merge pull request #136 from dfinity/gabor/assert
Browse files Browse the repository at this point in the history
Add an `assert` verifying that the subaccount blob has 32 bytes
  • Loading branch information
dfx-json authored Jan 31, 2024
2 parents d6234de + 0e6f288 commit 566935e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions motoko/ledger-transfer/src/ledger_transfer/Account.mo
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ module {
hash.write([0x0A]);
hash.write(Blob.toArray(Text.encodeUtf8("account-id")));
hash.write(Blob.toArray(Principal.toBlob(principal)));
assert subaccount.size() == 32;
hash.write(Blob.toArray(subaccount));
let hashSum = hash.sum();
let crc32Bytes = beBytes(CRC32.ofArray(hashSum));
Expand Down

0 comments on commit 566935e

Please sign in to comment.