Check field present for stOwnerCount.

This commit is contained in:
Arthur Britto
2012-12-13 16:55:37 -08:00
parent 345d8013ca
commit df4d2ec149
2 changed files with 20 additions and 5 deletions

View File

@@ -137,7 +137,8 @@ TER PaymentTransactor::doApply()
// Direct XRP payment.
const STAmount saSrcXRPBalance = mTxnAccount->getFieldAmount(sfBalance);
const uint32 uOwnerCount = mTxn.getFieldU32(sfOwnerCount);
const bool bOwnerCount = mTxn.isFieldPresent(sfPaths);
const uint32 uOwnerCount = bOwnerCount ? mTxn.getFieldU32(sfOwnerCount) : 0;
const uint64 uReserve = theConfig.FEE_ACCOUNT_RESERVE+uOwnerCount*theConfig.FEE_OWNER_RESERVE;
// Make sure have enough reserve to send.
@@ -145,7 +146,9 @@ TER PaymentTransactor::doApply()
&& saSrcXRPBalance < saDstAmount + uReserve) // Reserve is not scaled by fee.
{
// Vote no. However, transaction might succeed, if applied in a different order.
Log(lsINFO) << "doPayment: Delay transaction: Insufficient funds.";
Log(lsINFO) << "";
Log(lsINFO) << boost::str(boost::format("doPayment: Delay transaction: Insufficient funds: %s / %s (%d)")
% saSrcXRPBalance.getText() % (saDstAmount + uReserve).getText() % uReserve);
terResult = terUNFUNDED;
}

View File

@@ -262,8 +262,9 @@ buster.testCase("Sending", {
// XXX In the future add ledger_accept after partial retry is implemented in the server.
buster.testCase("Sending future", {
'setUp' : testutils.build_setup(),
'tearDown' : testutils.build_teardown(),
'setUp' : testutils.build_setup(),
// 'setUp' : testutils.build_setup({ verbose : true }),
'tearDown' : testutils.build_teardown(),
"direct ripple" :
function (done) {
@@ -670,7 +671,7 @@ buster.testCase("Indirect ripple", {
});
},
"indirect ripple with path and transfer fee" :
"//indirect ripple with path and transfer fee" :
function (done) {
var self = this;
@@ -720,6 +721,17 @@ buster.testCase("Indirect ripple", {
})
.submit();
},
// function (callback) {
// self.what = "Display ledger";
//
// self.remote.request_ledger('current', true)
// .on('success', function (m) {
// console.log("Ledger: %s", JSON.stringify(m, undefined, 2));
//
// callback();
// })
// .request();
// },
function (callback) {
self.what = "Verify balances.";