Do not subtract fee from 'bitcoin-cli sendtoaddress'

Test cases need to be as simple as possible for now.
This commit is contained in:
ghubstan 2020-07-17 12:31:03 -03:00
parent 2852e3da8b
commit 5d7133a9b4
No known key found for this signature in database
GPG key ID: E35592D6800A861E
2 changed files with 3 additions and 10 deletions

View file

@ -66,13 +66,13 @@ public final class BitcoinCliHelper {
generateToAddress(blocks, getNewBtcAddress());
}
public String sendToAddress(String address, double amount) {
public String sendToAddress(String address, String amount) {
// sendtoaddress "address" amount \
// ( "comment" "comment_to" subtractfeefromamount \
// replaceable conf_target "estimate_mode" )
// returns a transaction id
try {
String sendToAddressCmd = format("sendtoaddress \"%s\" %s \"\" \"\" true",
String sendToAddressCmd = format("sendtoaddress \"%s\" %s \"\" \"\" false",
address, amount);
BitcoinCli sendToAddress = new BitcoinCli(config, sendToAddressCmd).run();
String txid = sendToAddress.getOutput();

View file

@ -24,7 +24,6 @@ import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import static java.lang.Double.parseDouble;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
@ -56,13 +55,7 @@ public class FundWalletScenarioTest extends ScenarioTest {
assertEquals(1000000000, balance);
String unusedAddress = getUnusedBtcAddress();
// Given the default tx fee rate, we want to send 2.5 + the fee,
// so the new wallet balance will be exactly 12.5 btc.
// We should calculate the fee based on the fee rate and tx size
// instead of hard coding the fee amount.
double btc = parseDouble("2.5") + parseDouble("0.0000336");
bitcoinCli.sendToAddress(unusedAddress, btc);
bitcoinCli.sendToAddress(unusedAddress, "2.5");
bitcoinCli.generateBlocks(1);
sleep(1500);