Use addWithoutSigningFields in jtx::sign

This commit is contained in:
Scott Schurr
2015-12-17 09:57:19 -08:00
committed by Vinnie Falco
parent 889afd0cbd
commit 90466d6cde
2 changed files with 20 additions and 1 deletions

View File

@@ -561,6 +561,24 @@ public:
);
}
// Test that jtx can re-sign a transaction that's already been signed.
void testResignSigned()
{
using namespace jtx;
Env env(*this);
env.fund(XRP(10000), "alice");
auto const baseFee = env.open()->fees().base;
std::uint32_t const aliceSeq = env.seq ("alice");
// Sign jsonNoop.
Json::Value jsonNoop = env.json (
noop ("alice"), fee(baseFee), seq(aliceSeq), sig("alice"));
// Re-sign jsonNoop.
JTx jt = env.jt (jsonNoop);
env (jt);
}
void
run()
{
@@ -580,6 +598,7 @@ public:
testAdvance();
testClose();
testPath();
testResignSigned();
}
};

View File

@@ -50,7 +50,7 @@ sign (Json::Value& jv,
strHex(account.pk().slice());
Serializer ss;
ss.add32 (HashPrefix::txSign);
parse(jv).add(ss);
parse(jv).addWithoutSigningFields(ss);
auto const sig = ripple::sign(
*publicKeyType(account.pk().slice()),
account.sk(), ss.slice());