I'm trying to send funds to a smart contract using the following code, however, the balance is always 0.
TransactionReceipt transactionReceipt = Transfer.sendFunds(
web3j, credentials, recipient,
amount, Convert.Unit.WEI)
.sendAsync().get();
EthGetBalance contractGetBalance = web3j.ethGetBalance(recipient, DefaultBlockParameterName.LATEST)
.sendAsync().get();
BigInteger contractBalance = contractGetBalance.getBalance();
Why doesn't it go through? The smart contract code is:
pragma solidity ^0.4.7;
contract ReceiveContract {
address public owner;
function ReceiveContract() public {
owner = msg.sender;
}
function () payable public {
owner.transfer(msg.value);
}
}