为什么以下不起作用?
id s_id cell_load average_load
1 1 4 6
1 1 2 6
1 1 12 6
1 2 3 4
1 2 5 4
2 1 10 4.33
2 1 1 4.33
2 2 2 3.66
2 2 3 3.66
2 2 6 3.66
The contract won't allow this transaction to be executed
虽然这有效:
uint transactionFee = (msg.value * 2) / 100;
uint transactionReward = (msg.value * 2) / 100;
uint receiverMoney = msg.value - limitTransactionCosts(transactionFee - transactionReward);
答案 0 :(得分:0)
您的代码应该按预期运行,因为没有错误。 确保您的limitTransactionCosts具有有效的返回类型(int / float)。 请添加功能代码以进一步分析。
答案 1 :(得分:0)
发现我的错误。无论limitTransactionCosts如何,我都会发送交易费和奖励。
我的代码知道如下:
// Calculate costs
uint transactionCosts = (msg.value * 4) / 1000;
transactionCosts = limitTransactionCosts(transactionCosts);
uint transactionFee = transactionCosts / 2;
uint transactionReward = transactionCosts / 2;
uint receiverMoney = msg.value - transactionCosts;