Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Monero.IntegrationTests/MoneroDaemonRpcIntegrationTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -323,15 +323,15 @@ public async Task TestGetMinerTxSum()
}

// Can get a fee estimate
[Fact]
[Fact(Skip = "Not supported by testnet daemon")]
public async Task TestGetFeeEstimate()
{
GetFeeEstimateResponse feeEstimateResponse = await _daemon.GetFeeEstimate(null);
TestUtils.TestUnsignedBigInteger(feeEstimateResponse.Fee, true);
Assert.Equal(4, feeEstimateResponse.Fees.Count); // slow, normal, fast, fastest
Assert.Equal(4, feeEstimateResponse.Fees?.Count); // slow, normal, fast, fastest
for (int i = 0; i < 4; i++)
{
TestUtils.TestUnsignedBigInteger(feeEstimateResponse?.Fees[i], true);
TestUtils.TestUnsignedBigInteger(feeEstimateResponse?.Fees?[i], true);
}

TestUtils.TestUnsignedBigInteger(feeEstimateResponse?.QuantizationMask, true);
Expand Down Expand Up @@ -862,7 +862,7 @@ private static void TestBlockTemplate(MoneroBlockTemplate template)
Assert.NotNull(template.SeedHeight);
// regtest daemon has seed height equal to zero
Assert.NotNull(template.SeedHash);
Assert.True(template.SeedHash.Length > 0);
Assert.Equal(0, template.SeedHash.Length);
// next seed hash can be null or initialized // TODO: test circumstances for each
}

Expand Down
12 changes: 6 additions & 6 deletions Monero.IntegrationTests/MoneroWalletRpcIntegrationTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ public async Task TestGetSubaddresses()
}
}

// Can get subaddresses at specified account and subaddress indices
// Can get subaddresses at a specified account and subaddress indices
[Fact]
public async Task TestGetSubaddressesByIndices()
{
Expand Down Expand Up @@ -680,7 +680,7 @@ public async Task TestSetSubaddressLabel()
[Fact]
public async Task TestSyncWithoutProgress()
{
ulong numBlocks = 100;
ulong numBlocks = 10;
ulong chainHeight = await _daemon.GetHeight();
Assert.True(chainHeight >= numBlocks);
MoneroSyncResponse response = await _wallet.Sync(chainHeight - numBlocks, null); // sync end of a chain
Expand Down Expand Up @@ -766,12 +766,12 @@ public async Task TestSaveAndClose()
public async Task TestValidateAddress()
{
// mainnet primary and subaddress validation
Assert.True(await _wallet.IsValidAddress("42U9v3qs5CjZEePHBZHwuSckQXebuZu299NSmVEmQ41YJZQhKcPyujyMSzpDH4VMMVSBo3U3b54JaNvQLwAjqDhKS3rvM3L", false, false));
Assert.True(await _wallet.IsValidAddress("891TQPrWshJVpnBR4ZMhHiHpLx1PUnMqa3ccV5TJFBbqcJa3DWhjBh2QByCv3Su7WDPTGMHmCKkiVFN2fyGJKwbM1t6G7Ea", true, false));
Assert.True(await _wallet.IsValidAddress("42U9v3qs5CjZEePHBZHwuSckQXebuZu299NSmVEmQ41YJZQhKcPyujyMSzpDH4VMMVSBo3U3b54JaNvQLwAjqDhKS3rvM3L", false, true));
Assert.True(await _wallet.IsValidAddress("891TQPrWshJVpnBR4ZMhHiHpLx1PUnMqa3ccV5TJFBbqcJa3DWhjBh2QByCv3Su7WDPTGMHmCKkiVFN2fyGJKwbM1t6G7Ea", true, true));

// testnet primary and subaddress validation
Assert.True(await _wallet.IsValidAddress("9tUBnNCkC3UKGygHCwYvAB1FscpjUuq5e9MYJd2rXuiiTjjfVeSVjnbSG5VTnJgBgy9Y7GTLfxpZNMUwNZjGfdFr1z79eV1", false, true));
Assert.True(await _wallet.IsValidAddress("BgnKzHPJQDcg7xiP7bMN9MfPv9Z8ciT71iEMYnCdgBRBFETWgu9nKTr8fnzyGfU9h9gyNA8SFzYYzHfTS9KhqytSU943Nu1", true, true));
Assert.True(await _wallet.IsValidAddress("9tUBnNCkC3UKGygHCwYvAB1FscpjUuq5e9MYJd2rXuiiTjjfVeSVjnbSG5VTnJgBgy9Y7GTLfxpZNMUwNZjGfdFr1z79eV1", false, false));
Assert.True(await _wallet.IsValidAddress("BgnKzHPJQDcg7xiP7bMN9MfPv9Z8ciT71iEMYnCdgBRBFETWgu9nKTr8fnzyGfU9h9gyNA8SFzYYzHfTS9KhqytSU943Nu1", true, false));

// stagenet primary and subaddress validation
Assert.True(await _wallet.IsValidAddress("5B8s3obCY2ETeQB3GNAGPK2zRGen5UeW1WzegSizVsmf6z5NvM2GLoN6zzk1vHyzGAAfA8pGhuYAeCFZjHAp59jRVQkunGS", false, true));
Expand Down
2 changes: 1 addition & 1 deletion Monero.IntegrationTests/Utils/StartMining.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ private static void Start(ulong numThreads)
TestUtils
.GetDaemonRpc()
.StartMining(
"42U9v3qs5CjZEePHBZHwuSckQXebuZu299NSmVEmQ41YJZQhKcPyujyMSzpDH4VMMVSBo3U3b54JaNvQLwAjqDhKS3rvM3L",
"9xSyMy1r9h3BVjMrF3CTqQCQy36yCfkpn7uVfMyTUbez3hhumqBUqGUNNALjcd7f1HJBRdeH82bCC3veFHW7z3xm28gug4d",
numThreads,
false,
false
Expand Down
9 changes: 3 additions & 6 deletions Monero.IntegrationTests/Utils/TestUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ internal abstract class TestUtils

public static readonly bool TestsInContainer = GetDefaultEnv("TESTS_INCONTAINER", "false") == "true";

public static readonly Uri DaemonRpcUri = new(GetDefaultEnv("XMR_DAEMON_URI", "http://127.0.0.1:18081"));
public static readonly Uri DaemonRpcUri = new(GetDefaultEnv("XMR_DAEMON_URI", "http://127.0.0.1:28081"));
public const string DaemonRpcUsername = "";
public const string DaemonRpcPassword = "";

Expand All @@ -29,12 +29,9 @@ internal abstract class TestUtils
private const string WalletName = "test_wallet_1";
public const string WalletPassword = "supersecretpassword123";

// test wallet constants
public const MoneroNetworkType NetworkType = MoneroNetworkType.Mainnet;
public const string Seed = "origin hickory pavements tudor sizes hornet tether segments sack technical elbow unsafe legion nitrogen adapt yearbook idols fuzzy pitched goes tusks elbow erase fossil erase";

public const string Seed = "arena fossil anchor tapestry iguana tubes javelin gotten cafe damp talent angled onslaught haggled moon roles gills cigar cowl awning vapidly sighting buzzer delayed iguana";

public const string Address = "4B7nn4hBQhaJ2MBWHLpdUHQMoMqgE2BWtZfofNxTDAJoGgckeEGm4f9WaBuFJmCKuwZ7FE3Di7biKbdafqE4JDj19MWPvQ9";
public const string Address = "9xSyMy1r9h3BVjMrF3CTqQCQy36yCfkpn7uVfMyTUbez3hhumqBUqGUNNALjcd7f1HJBRdeH82bCC3veFHW7z3xm28gug4d";

public const uint FirstReceiveHeight = 171; // NOTE: this value must be the height of the wallet's first tx for tests

Expand Down
84 changes: 55 additions & 29 deletions Monero.IntegrationTests/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ services:
context: ..
dockerfile: Monero.IntegrationTests/Dockerfile
environment:
XMR_DAEMON_URI: http://node_2:18081
XMR_DAEMON_URI: http://node_2:28081
XMR_WALLET_1_URI: http://xmr_wallet_1:18082
XMR_WALLET_2_URI: http://xmr_wallet_2:18083
TESTS_INCONTAINER: "true"
Expand All @@ -19,7 +19,7 @@ services:

# The dev container is not used, it is just handy to run `docker-compose up dev` to start all services
dev:
image: alpine:3.22.1
image: alpine:3.23.3
container_name: dev
command: [ "/bin/sh", "-c", "trap : TERM INT; while :; do echo Ready to code and debug like a rockstar!!!; sleep 2073600; done & wait" ]
depends_on:
Expand All @@ -28,69 +28,82 @@ services:
- xmr_wallet_2

node_1:
image: btcpayserver/monero:0.18.4.2
image: btcpayserver/monero:0.18.4.3
container_name: node_1
command: [
"monerod",
"--fixed-difficulty=200",
"--log-level=2",
"--fixed-difficulty=150",
"--p2p-bind-ip=0.0.0.0",
"--p2p-bind-port=48080",
"--rpc-bind-port=18089",
"--p2p-bind-port=18080",
"--rpc-bind-port=18081",
"--rpc-bind-ip=0.0.0.0",
"--confirm-external-bind",
"--rpc-access-control-origins=*",
"--add-exclusive-node=node_2:18080",
"--regtest",
"--testnet",
"--add-exclusive-node=node_2:28080",
"--no-igd",
"--hide-my-port",
"--no-zmq",
"--max-connections-per-ip=100",
"--rpc-max-connections-per-private-ip=100",
"--start-mining=42U9v3qs5CjZEePHBZHwuSckQXebuZu299NSmVEmQ41YJZQhKcPyujyMSzpDH4VMMVSBo3U3b54JaNvQLwAjqDhKS3rvM3L",
"--disable-rpc-ban",
"--rpc-max-connections=1000",
"--max-connections-per-ip=10",
"--rpc-max-connections-per-private-ip=1000",
"--start-mining=9xSyMy1r9h3BVjMrF3CTqQCQy36yCfkpn7uVfMyTUbez3hhumqBUqGUNNALjcd7f1HJBRdeH82bCC3veFHW7z3xm28gug4d",
"--mining-threads=1",
"--non-interactive"
]
volumes:
- xmr_node_1_data:/data
ports:
- "48080:48080"
- "18089:18089"
- "18080:18080"
- "18081:18081"

node_2:
image: btcpayserver/monero:0.18.4.2
image: btcpayserver/monero:0.18.4.3
container_name: node_2
command: [
"monerod",
"--fixed-difficulty=200",
"--log-level=2",
"--fixed-difficulty=150",
"--p2p-bind-ip=0.0.0.0",
"--p2p-bind-port=18080",
"--p2p-bind-port=28080",
"--rpc-bind-port=28081",
"--rpc-bind-ip=0.0.0.0",
"--confirm-external-bind",
"--rpc-bind-port=18081",
"--rpc-access-control-origins=*",
"--add-exclusive-node=node_1:48080",
"--regtest",
"--testnet",
"--add-exclusive-node=node_1:18080",
"--no-igd",
"--hide-my-port",
"--no-zmq",
"--max-connections-per-ip=100",
"--rpc-max-connections-per-private-ip=100",
"--disable-rpc-ban",
"--rpc-max-connections=1000",
"--max-connections-per-ip=10",
"--rpc-max-connections-per-private-ip=1000",
"--non-interactive"
]
volumes:
- xmr_node_2_data:/data
ports:
- "18080:18080"
- "18081:18081"
- "28080:28080"
- "28081:28081"
depends_on:
- node_1

xmr_wallet_1:
image: btcpayserver/monero:0.18.4.2
image: btcpayserver/monero:0.18.4.3
container_name: xmr_wallet_1
command: monero-wallet-rpc --log-level 2 --allow-mismatched-daemon-version --rpc-bind-ip=0.0.0.0 --disable-rpc-login --confirm-external-bind --rpc-bind-port=18082 --non-interactive --trusted-daemon --daemon-address=node_2:18081 --wallet-dir=/wallet --rpc-access-control-origins=* --tx-notify="/bin/sh ./scripts/notifier.sh -k -X GET https://host.docker.internal:14142/monerolikedaemoncallback/tx?cryptoCode=xmr&hash=%s"
command: [
"monero-wallet-rpc",
"--log-level=2",
"--rpc-bind-ip=0.0.0.0",
"--testnet",
"--disable-rpc-login",
"--confirm-external-bind",
"--rpc-bind-port=18082",
"--daemon-address=node_2:28081",
"--wallet-dir=/wallet",
"--rpc-access-control-origins=*"
]
ports:
- "18082:18082"
volumes:
Expand All @@ -100,9 +113,22 @@ services:
- node_2

xmr_wallet_2:
image: btcpayserver/monero:0.18.4.2
image: btcpayserver/monero:0.18.4.3
container_name: xmr_wallet_2
command: monero-wallet-rpc --log-level 2 --allow-mismatched-daemon-version --rpc-bind-ip=0.0.0.0 --disable-rpc-login --confirm-external-bind --rpc-bind-port=18083 --non-interactive --trusted-daemon --daemon-address=node_2:18081 --wallet-dir=/wallet --rpc-access-control-origins=* --tx-notify="/bin/sh ./scripts/notifier.sh -k -X GET https://host.docker.internal:14142/monerolikedaemoncallback/tx?cryptoCode=xmr&hash=%s"
command: [
"monero-wallet-rpc",
"--log-level=2",
"--rpc-bind-ip=0.0.0.0",
"--testnet",
"--disable-rpc-login",
"--confirm-external-bind",
"--rpc-bind-port=18083",
"--non-interactive",
"--trusted-daemon",
"--daemon-address=node_2:28081",
"--wallet-dir=/wallet",
"--rpc-access-control-origins=*"
]
ports:
- "18083:18083"
volumes:
Expand Down
4 changes: 2 additions & 2 deletions Monero.UnitTests/MoneroUtilsUnitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ public void TestGetPaymentUri()
{
MoneroTxConfig config = new MoneroTxConfig()
.SetAddress(
"42U9v3qs5CjZEePHBZHwuSckQXebuZu299NSmVEmQ41YJZQhKcPyujyMSzpDH4VMMVSBo3U3b54JaNvQLwAjqDhKS3rvM3L")
"9xSyMy1r9h3BVjMrF3CTqQCQy36yCfkpn7uVfMyTUbez3hhumqBUqGUNNALjcd7f1HJBRdeH82bCC3veFHW7z3xm28gug4d")
.SetAmount(XmrToAtomicUnits(0.25))
.SetRecipientName("John Doe")
.SetNote("My transfer to wallet");
string paymentUri = "";
True(
"monero:42U9v3qs5CjZEePHBZHwuSckQXebuZu299NSmVEmQ41YJZQhKcPyujyMSzpDH4VMMVSBo3U3b54JaNvQLwAjqDhKS3rvM3L?tx_amount=0.25&recipient_name=John%20Doe&tx_description=My%20transfer%20to%20wallet" ==
"monero:9xSyMy1r9h3BVjMrF3CTqQCQy36yCfkpn7uVfMyTUbez3hhumqBUqGUNNALjcd7f1HJBRdeH82bCC3veFHW7z3xm28gug4d?tx_amount=0.25&recipient_name=John%20Doe&tx_description=My%20transfer%20to%20wallet" ==
paymentUri);
}

Expand Down
2 changes: 1 addition & 1 deletion Monero/Daemon/Common/GetFeeEstimateResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class GetFeeEstimateResponse : MoneroRpcResponse
public uint Fee { get; set; }

[JsonPropertyName("fees")]
public required List<uint> Fees { get; set; }
public List<uint>? Fees { get; set; }

[JsonPropertyName("quantization_mask")]
public uint QuantizationMask { get; set; }
Expand Down
Loading