我与以太币智能合约有功能:
event onPledged(uint indexed featureKey, uint date, address backer, uint256 amount);
...
function pledge(uint featureKey) public
payable
withState(featureKey, State.Funding)
{
...
// event
onPledged(featureKey, now, backer, pledgeAmount);
...
}
我正在使用java测试(使用web3j和web3j-maven-plugin生成智能合约java包装器)来调用检查事件的pledge()
:
// pledge
logger.info("Pledging by backer ...");
TransactionReceipt pledgeReceipt = pledgerContract.pledge(featureKey, fixedPledgeAmount).send();
List<AppetissimoContract.OnPledgedEventResponse> pledgedEvents = minerContract.getOnPledgedEvents(pledgeReceipt);
assertEquals(1, pledgedEvents.size()); // true
如果我将支持者事件字段更改为indexed
,则测试开始失败:
event onPledged(uint indexed featureKey, uint date, address indexed backer, uint256 amount);
现在它失败了,因为没有事件(0):
assertEquals(1, pledgedEvents.size()); // false, size() is 0
在可靠性docs中写道,最多3个字段可以是indexed
:
> Up to three parameters can receive the attribute indexed which will cause the respective arguments to be searched for: It is possible to filter for specific values of indexed arguments in the user interface.
问题是web3j吗?使用indexed
属性是否需要更多气体(因此达到气体极限可能是共振)?