mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 02:55:50 +00:00
Merge branch 'fixrequiredst' into master
This commit is contained in:
@@ -32,7 +32,7 @@ TER AccountSetTransactor::doApply()
|
|||||||
|
|
||||||
if ((uTxFlags & tfRequireAuth) && !isSetBit(uFlagsIn, lsfRequireAuth))
|
if ((uTxFlags & tfRequireAuth) && !isSetBit(uFlagsIn, lsfRequireAuth))
|
||||||
{
|
{
|
||||||
if (mTxn.getFieldU32(sfOwnerCount))
|
if (mTxnAccount->getFieldU32(sfOwnerCount))
|
||||||
{
|
{
|
||||||
cLog(lsINFO) << "AccountSet: Retry: OwnerCount not zero.";
|
cLog(lsINFO) << "AccountSet: Retry: OwnerCount not zero.";
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ TER AccountSetTransactor::doApply()
|
|||||||
return temINVALID_FLAG;
|
return temINVALID_FLAG;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((uTxFlags & tfOptionalDestTag) && !isSetBit(uFlagsIn, lsfRequireDestTag))
|
if ((uTxFlags & tfRequireDestTag) && !isSetBit(uFlagsIn, lsfRequireDestTag))
|
||||||
{
|
{
|
||||||
cLog(lsINFO) << "AccountSet: Set lsfRequireDestTag.";
|
cLog(lsINFO) << "AccountSet: Set lsfRequireDestTag.";
|
||||||
|
|
||||||
|
|||||||
221
test/account_set-test.js
Normal file
221
test/account_set-test.js
Normal file
@@ -0,0 +1,221 @@
|
|||||||
|
var async = require("async");
|
||||||
|
var buster = require("buster");
|
||||||
|
|
||||||
|
var Amount = require("ripple-lib").Amount;
|
||||||
|
var Remote = require("ripple-lib").Remote;
|
||||||
|
var Request = require("ripple-lib").Request;
|
||||||
|
var Server = require("./server").Server;
|
||||||
|
|
||||||
|
var testutils = require("./testutils");
|
||||||
|
|
||||||
|
var config = require('ripple-lib').config.load(require('./config'));
|
||||||
|
|
||||||
|
// How long to wait for server to start.
|
||||||
|
var serverDelay = 1500;
|
||||||
|
|
||||||
|
buster.testRunner.timeout = 5000;
|
||||||
|
|
||||||
|
buster.testCase("AccountSet", {
|
||||||
|
'setUp' : testutils.build_setup(),
|
||||||
|
// 'setUp' : testutils.build_setup({verbose: true , no_server: false}),
|
||||||
|
'tearDown' : testutils.build_teardown(),
|
||||||
|
|
||||||
|
"RequireDestTag" :
|
||||||
|
function (done) {
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
async.waterfall([
|
||||||
|
function (callback) {
|
||||||
|
self.what = "Set RequireDestTag.";
|
||||||
|
|
||||||
|
self.remote.transaction()
|
||||||
|
.account_set("root")
|
||||||
|
.set_flags('RequireDestTag')
|
||||||
|
.on('proposed', function (m) {
|
||||||
|
//console.log("proposed: %s", JSON.stringify(m));
|
||||||
|
|
||||||
|
callback(m.result !== 'tesSUCCESS');
|
||||||
|
})
|
||||||
|
.submit();
|
||||||
|
},
|
||||||
|
function (callback) {
|
||||||
|
self.what = "Check RequireDestTag";
|
||||||
|
|
||||||
|
self.remote.request_account_flags('root', 'CURRENT')
|
||||||
|
.on('success', function (m) {
|
||||||
|
var wrong = !(m.node.Flags & Remote.flags.account_root.RequireDestTag);
|
||||||
|
|
||||||
|
if (wrong)
|
||||||
|
console.log("Set RequireDestTag: failed: %s", JSON.stringify(m));
|
||||||
|
|
||||||
|
callback(wrong);
|
||||||
|
})
|
||||||
|
.request();
|
||||||
|
},
|
||||||
|
function (callback) {
|
||||||
|
self.what = "Clear RequireDestTag.";
|
||||||
|
|
||||||
|
self.remote.transaction()
|
||||||
|
.account_set("root")
|
||||||
|
.set_flags('OptionalDestTag')
|
||||||
|
.on('proposed', function (m) {
|
||||||
|
//console.log("proposed: %s", JSON.stringify(m));
|
||||||
|
|
||||||
|
callback(m.result !== 'tesSUCCESS');
|
||||||
|
})
|
||||||
|
.submit();
|
||||||
|
},
|
||||||
|
function (callback) {
|
||||||
|
self.what = "Check No RequireDestTag";
|
||||||
|
|
||||||
|
self.remote.request_account_flags('root', 'CURRENT')
|
||||||
|
.on('success', function (m) {
|
||||||
|
var wrong = !!(m.node.Flags & Remote.flags.account_root.RequireDestTag);
|
||||||
|
|
||||||
|
if (wrong)
|
||||||
|
console.log("Clear RequireDestTag: failed: %s", JSON.stringify(m));
|
||||||
|
|
||||||
|
callback(wrong);
|
||||||
|
})
|
||||||
|
.request();
|
||||||
|
},
|
||||||
|
], function (error) {
|
||||||
|
buster.refute(error, self.what);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
"RequireAuth" :
|
||||||
|
function (done) {
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
async.waterfall([
|
||||||
|
function (callback) {
|
||||||
|
self.what = "Set RequireAuth.";
|
||||||
|
|
||||||
|
self.remote.transaction()
|
||||||
|
.account_set("root")
|
||||||
|
.set_flags('RequireAuth')
|
||||||
|
.on('proposed', function (m) {
|
||||||
|
//console.log("proposed: %s", JSON.stringify(m));
|
||||||
|
|
||||||
|
callback(m.result !== 'tesSUCCESS');
|
||||||
|
})
|
||||||
|
.submit();
|
||||||
|
},
|
||||||
|
function (callback) {
|
||||||
|
self.what = "Check RequireAuth";
|
||||||
|
|
||||||
|
self.remote.request_account_flags('root', 'CURRENT')
|
||||||
|
.on('success', function (m) {
|
||||||
|
var wrong = !(m.node.Flags & Remote.flags.account_root.RequireAuth);
|
||||||
|
|
||||||
|
if (wrong)
|
||||||
|
console.log("Set RequireAuth: failed: %s", JSON.stringify(m));
|
||||||
|
|
||||||
|
callback(wrong);
|
||||||
|
})
|
||||||
|
.request();
|
||||||
|
},
|
||||||
|
function (callback) {
|
||||||
|
self.what = "Clear RequireAuth.";
|
||||||
|
|
||||||
|
self.remote.transaction()
|
||||||
|
.account_set("root")
|
||||||
|
.set_flags('OptionalAuth')
|
||||||
|
.on('proposed', function (m) {
|
||||||
|
//console.log("proposed: %s", JSON.stringify(m));
|
||||||
|
|
||||||
|
callback(m.result !== 'tesSUCCESS');
|
||||||
|
})
|
||||||
|
.submit();
|
||||||
|
},
|
||||||
|
function (callback) {
|
||||||
|
self.what = "Check No RequireAuth";
|
||||||
|
|
||||||
|
self.remote.request_account_flags('root', 'CURRENT')
|
||||||
|
.on('success', function (m) {
|
||||||
|
var wrong = !!(m.node.Flags & Remote.flags.account_root.RequireAuth);
|
||||||
|
|
||||||
|
if (wrong)
|
||||||
|
console.log("Clear RequireAuth: failed: %s", JSON.stringify(m));
|
||||||
|
|
||||||
|
callback(wrong);
|
||||||
|
})
|
||||||
|
.request();
|
||||||
|
},
|
||||||
|
// XXX Also check fails if something is owned.
|
||||||
|
], function (error) {
|
||||||
|
buster.refute(error, self.what);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
"DisallowXRP" :
|
||||||
|
function (done) {
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
async.waterfall([
|
||||||
|
function (callback) {
|
||||||
|
self.what = "Set DisallowXRP.";
|
||||||
|
|
||||||
|
self.remote.transaction()
|
||||||
|
.account_set("root")
|
||||||
|
.set_flags('DisallowXRP')
|
||||||
|
.on('proposed', function (m) {
|
||||||
|
//console.log("proposed: %s", JSON.stringify(m));
|
||||||
|
|
||||||
|
callback(m.result !== 'tesSUCCESS');
|
||||||
|
})
|
||||||
|
.submit();
|
||||||
|
},
|
||||||
|
function (callback) {
|
||||||
|
self.what = "Check DisallowXRP";
|
||||||
|
|
||||||
|
self.remote.request_account_flags('root', 'CURRENT')
|
||||||
|
.on('success', function (m) {
|
||||||
|
var wrong = !(m.node.Flags & Remote.flags.account_root.DisallowXRP);
|
||||||
|
|
||||||
|
if (wrong)
|
||||||
|
console.log("Set RequireDestTag: failed: %s", JSON.stringify(m));
|
||||||
|
|
||||||
|
callback(wrong);
|
||||||
|
})
|
||||||
|
.request();
|
||||||
|
},
|
||||||
|
function (callback) {
|
||||||
|
self.what = "Clear DisallowXRP.";
|
||||||
|
|
||||||
|
self.remote.transaction()
|
||||||
|
.account_set("root")
|
||||||
|
.set_flags('AllowXRP')
|
||||||
|
.on('proposed', function (m) {
|
||||||
|
//console.log("proposed: %s", JSON.stringify(m));
|
||||||
|
|
||||||
|
callback(m.result !== 'tesSUCCESS');
|
||||||
|
})
|
||||||
|
.submit();
|
||||||
|
},
|
||||||
|
function (callback) {
|
||||||
|
self.what = "Check AllowXRP";
|
||||||
|
|
||||||
|
self.remote.request_account_flags('root', 'CURRENT')
|
||||||
|
.on('success', function (m) {
|
||||||
|
var wrong = !!(m.node.Flags & Remote.flags.account_root.DisallowXRP);
|
||||||
|
|
||||||
|
if (wrong)
|
||||||
|
console.log("Clear DisallowXRP: failed: %s", JSON.stringify(m));
|
||||||
|
|
||||||
|
callback(wrong);
|
||||||
|
})
|
||||||
|
.request();
|
||||||
|
},
|
||||||
|
], function (error) {
|
||||||
|
buster.refute(error, self.what);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// vim:sw=2:sts=2:ts=8:et
|
||||||
Reference in New Issue
Block a user