Skip to content

Commit

Permalink
fix: ICRC ledger gives log_length as num_blocks + 1
Browse files Browse the repository at this point in the history
  • Loading branch information
yanliu38 committed Feb 1, 2025
1 parent 777ba35 commit dcb6886
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ic-canister/src/canister_backend/pre_icrc3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub fn _get_transactions(req: GetTransactionsRequest) -> GetTransactionsResponse
GetTransactionsResponse {
// We don't have archived transactions in this implementation, so the first_index is always the requested tx number
first_index: txs_from.into(),
log_length: RecentCache::get_max_tx_num().unwrap_or_default().into(),
log_length: candid::Nat::from(RecentCache::get_next_tx_num()),
transactions: txs,
archived_transactions: vec![],
}
Expand Down
2 changes: 1 addition & 1 deletion ic-canister/tests/test_icrc1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ fn test_multiple_transfers() {

let get_tx_response1 = get_tx(10, 1);
assert_eq!(get_tx_response1.first_index, 10u64);
assert_eq!(get_tx_response1.log_length, 10u8);
assert_eq!(get_tx_response1.log_length, 11u8);

assert_eq!(get_tx_response1.transactions.len(), 1);
assert_eq!(
Expand Down

0 comments on commit dcb6886

Please sign in to comment.