{ hash: '0xcc871efa64631ff57b6c4cdf9e9c52dce299956cc0bc2cdf6781dbd647a80926',
nonce: 34,
blockHash: '0xf4e21dabc0d6f99ae9a3fd128b9f25462110ed0e2811c0d5f91ffce9ac85594a',
blockNumber: 49,
transactionIndex: 0,
from: '0x9c3fe8bc6d259d44e80fb728e74727bfbe58e988',
to: '0xb22ab8533936d6d75c1ecf229c1ad68410ea8ee3',
value: { [String: '0'] s: 1, e: 0, c: [ 0 ] },
gas: 3141592,
gasPrice: { [String: '1'] s: 1, e: 0, c: [ 1 ] },
input: '0x1f5c1d9800000000000000000000000000000000000000000000000000000000000000400000000000000000000000007fa543843e2f5766ad623b2155d639d73635824400000000000000000000000000000000000000000000000000000000000000134f70656e20412042616e6b204163636f756e7400000000000000000000000000’ }
我从一个 x.send(1) 返回一个交易,它的 JSON 看起来像上面。我可以在输入属性的值中看到,有一个“7fa543843e2f5766ad623b2155d639d736358244”与我为 x 提供的帐户地址匹配。Solidity 片段是:
function do(string _description, address x) {
if ( msg.sender != owner )
throw;
description = _description;
x.send(1);
}
但是,JSON 中的 to: 属性是错误的。我的环境使用在 Truffle 中针对 TestRPC 运行的测试。有没有人认为这是一个已知问题或我的问题?
我的测试代码的适当部分是:
.then(
function (_bool0) {
assert.isTrue(_bool0,"whoops");
return contract.do("a test", accounts[4], {from: accounts[0]} );
}).then(
function (tx_id) {
var transaction = web3.eth.getTransaction(tx_id);
/* debugging my test */
console.log(transaction);
assert.strictEqual(transaction.to,accounts[4],"transaction \"to:\" was not provided address");
done();
}
).catch(done);