Skip to content

Commit

Permalink
Now print the missing case of PGF IBC targets.
Browse files Browse the repository at this point in the history
  • Loading branch information
murisi committed Feb 9, 2024
1 parent f2c8b20 commit 7cf3c72
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
23 changes: 20 additions & 3 deletions app/src/parser_impl_txn.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,24 +368,41 @@ static parser_error_t readPGFTarget(parser_context_t *ctx, uint16_t *pos, uint16
// Target
uint32_t target_len;
CHECK_ERROR(readUint32(ctx, &target_len))
bytes_t target;
target.len = target_len;
CHECK_ERROR(readBytes(ctx, &target.ptr, target.len))
bytes_t target_bytes;
target_bytes.len = target_len;
CHECK_ERROR(readBytes(ctx, &target_bytes.ptr, target_bytes.len))
SELECT(pos, target, {
snprintf(outKey, outKeyLen, "Target");
pageStringExt(outVal, outValLen, (const char*)target_bytes.ptr, target_bytes.len, pageIdx, pageCount);
})
// Amount
uint256_t amount;
CHECK_ERROR(readUint256(ctx, &amount))
SELECT(pos, target, {
snprintf(outKey, outKeyLen, "Amount");
CHECK_ERROR(print_uint256(&amount, COIN_AMOUNT_DECIMAL_PLACES, COIN_TICKER,
outVal, outValLen, pageIdx, pageCount))
})
// Port
uint32_t port_id_len;
CHECK_ERROR(readUint32(ctx, &port_id_len))
bytes_t port_id;
port_id.len = port_id_len;
CHECK_ERROR(readBytes(ctx, &port_id.ptr, port_id.len))
SELECT(pos, target, {
snprintf(outKey, outKeyLen, "Port ID");
pageStringExt(outVal, outValLen, (const char*)port_id.ptr, port_id.len, pageIdx, pageCount);
})
// Channel ID
uint32_t channel_id_len;
CHECK_ERROR(readUint32(ctx, &channel_id_len))
bytes_t channel_id;
channel_id.len = channel_id_len;
CHECK_ERROR(readBytes(ctx, &channel_id.ptr, channel_id.len))
SELECT(pos, target, {
snprintf(outKey, outKeyLen, "Channel ID");
pageStringExt(outVal, outValLen, (const char*)channel_id.ptr, channel_id.len, pageIdx, pageCount);
})
return parser_ok;
} default: return parser_unexpected_type;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/testvectors.json

Large diffs are not rendered by default.

0 comments on commit 7cf3c72

Please sign in to comment.