Skip to content

Commit f528d2d

Browse files
Bump Bitcoin Core to 27.1 (#1247)
* Bump Bitcoin Core to 27.1 * Fix TestMempoolAccept's MaxFeeRate
1 parent 7c86847 commit f528d2d

File tree

3 files changed

+37
-2
lines changed

3 files changed

+37
-2
lines changed

NBitcoin.TestFramework/WellknownNodeDownloadData.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,34 @@ public class BitcoinNodeDownloadData : NodeDownloadDataBase
448448
UseSectionInConfigFile = true,
449449
CreateWallet = true
450450
};
451+
452+
public NodeDownloadData v27_1 = new NodeDownloadData()
453+
{
454+
Version = "27.1",
455+
Linux = new NodeOSDownloadData()
456+
{
457+
Archive = "bitcoin-{0}-x86_64-linux-gnu.tar.gz",
458+
DownloadLink = "https://bitcoincore.org/bin/bitcoin-core-{0}/bitcoin-{0}-x86_64-linux-gnu.tar.gz",
459+
Executable = "bitcoin-{0}/bin/bitcoind",
460+
Hash = "c9840607d230d65f6938b81deaec0b98fe9cb14c3a41a5b13b2c05d044a48422"
461+
},
462+
Mac = new NodeOSDownloadData()
463+
{
464+
Archive = "bitcoin-{0}-x86_64-apple-darwin.tar.gz",
465+
DownloadLink = "https://bitcoincore.org/bin/bitcoin-core-{0}/bitcoin-{0}-x86_64-apple-darwin.tar.gz",
466+
Executable = "bitcoin-{0}/bin/bitcoind",
467+
Hash = "6d94bde5541a18964c1c36b0f12334004e45e195f244e381fd459827b1fdc395"
468+
},
469+
Windows = new NodeOSDownloadData()
470+
{
471+
Executable = "bitcoin-{0}/bin/bitcoind.exe",
472+
DownloadLink = "https://bitcoincore.org/bin/bitcoin-core-{0}/bitcoin-{0}-win64.zip",
473+
Archive = "bitcoin-{0}-win64.zip",
474+
Hash = "9719871a2c9a45c741e33d670d2319dcd3f8f52a6059e9c435a9a2841188b932"
475+
},
476+
UseSectionInConfigFile = true,
477+
CreateWallet = true
478+
};
451479
}
452480

453481
public class LitecoinNodeDownloadData : NodeDownloadDataBase

NBitcoin.Tests/RPCClientTests.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1915,7 +1915,10 @@ public void ShouldWalletProcessPSBTAndExtractMempoolAcceptableTX()
19151915
tx = builder.Network.CreateTransaction();
19161916
foreach (var coin in spendableCoins)
19171917
tx.Inputs.Add(coin.Outpoint);
1918+
var total = spendableCoins.Sum(c => c.Amount);
19181919
tx.Outputs.Add(new TxOut(Money.Coins(45), kOut));
1920+
// Change output
1921+
tx.Outputs.Add(new TxOut(total - Money.Coins(45) - Money.Satoshis(5000), spendableCoins.First().ScriptPubKey));
19191922
var psbtUnFinalized = PSBT.FromTransaction(tx, builder.Network);
19201923

19211924
var type = SigHash.All;
@@ -1939,8 +1942,12 @@ public void ShouldWalletProcessPSBTAndExtractMempoolAcceptableTX()
19391942
result.PSBT.Finalize();
19401943

19411944
var txResult = result.PSBT.ExtractTransaction();
1942-
var acceptResult = client.TestMempoolAccept(txResult, new TestMempoolParameters() { MaxFeeRate = new FeeRate(10_000m) });
1945+
var estimatedFeeRate = result.PSBT.GetEstimatedFeeRate();
1946+
var acceptResult = client.TestMempoolAccept(txResult, new TestMempoolParameters() { MaxFeeRate = new FeeRate(estimatedFeeRate.FeePerK + new Money(1)) });
19431947
Assert.True(acceptResult.IsAllowed, acceptResult.RejectReason);
1948+
acceptResult = client.TestMempoolAccept(txResult, new TestMempoolParameters() { MaxFeeRate = new FeeRate(estimatedFeeRate.FeePerK - Money.Satoshis(10)) });
1949+
Assert.False(acceptResult.IsAllowed, acceptResult.RejectReason);
1950+
Assert.Equal("max-fee-exceeded", acceptResult.RejectReason);
19441951
}
19451952
}
19461953

NBitcoin/RPC/RPCClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1724,7 +1724,7 @@ public async Task<MempoolAcceptResult> TestMempoolAcceptAsync(Transaction transa
17241724
{
17251725
try
17261726
{
1727-
var feeRateDecimal = feeRate.FeePerK.ToDecimal(MoneyUnit.Satoshi);
1727+
var feeRateDecimal = feeRate.FeePerK.ToDecimal(MoneyUnit.BTC);
17281728
response = await SendCommandAsync(RPCOperations.testmempoolaccept, cancellationToken, new[] { transaction.ToHex() }, feeRateDecimal).ConfigureAwait(false);
17291729
}
17301730
catch (RPCException ex) when (ex.Message == "Expected type bool, got number")

0 commit comments

Comments
 (0)