Skip to content

Commit

Permalink
Restore token ID to list coll tokens (#1281)
Browse files Browse the repository at this point in the history
Co-authored-by: Prasanna Loganathar <[email protected]>
  • Loading branch information
Bushstar and prasannavl authored May 24, 2022
1 parent bcce2b4 commit 3a21801
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/masternodes/masternodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1185,6 +1185,11 @@ boost::optional<CLoanView::CLoanSetCollateralTokenImpl> CCustomCSView::GetCollat
collToken.factor = attributes->GetValue(factorKey, CAmount{0});
collToken.idToken = id;

auto token = GetToken(id);
if (token) {
collToken.creationTx = token->creationTx;
}

return collToken;
}
}
Expand Down
10 changes: 10 additions & 0 deletions test/functional/feature_loan_setcollateraltoken.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,5 +226,15 @@ def run_test(self):
assert_equal(result[f'v0/token/{idGOOGL}/loan_collateral_factor'], '0.12345678')
assert_equal(result[f'v0/token/{idGOOGL}/fixed_interval_price_id'], 'GOOGL/USD')

# Get token creation TX
token = self.nodes[0].gettoken(idGOOGL)[idGOOGL]

# Check entry in list collateral tokens
result = self.nodes[0].listcollateraltokens()[2]
assert_equal(result['token'], 'GOOGL')
assert_equal(result['tokenId'], token['creationTx'])
assert_equal(result['factor'], Decimal('0.50000000'))
assert_equal(result['fixedIntervalPriceId'], 'GOOGL/USD')

if __name__ == '__main__':
LoanSetCollateralTokenTest().main()

0 comments on commit 3a21801

Please sign in to comment.