Skip to content

Commit

Permalink
Merge branch 'development' into fix-wallet-cancel-transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
aviator-app[bot] authored Aug 4, 2021
2 parents 4a41b91 + ee13b53 commit 994ea26
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 4,873 deletions.
10 changes: 9 additions & 1 deletion common/config/presets/tari_config_example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,6 @@ monerod_url = "http://monero-stagenet.exan.tech:38081" # stagenet

# Address of the tari_merge_mining_proxy application
proxy_host_address = "127.0.0.1:7878"
transcoder_host_address = "127.0.0.1:7879"

# In sole merged mining, the block solution is usually submitted to the Monero blockchain
# (monerod) as well as to the Tari blockchain, then this setting should be "true". With pool
Expand All @@ -492,6 +491,11 @@ monerod_password = ""
# accepted. (Default value = true; will wait for base node initial sync).
#wait_for_initial_sync_at_startup = true

[stratum_transcoder]

# Address of the tari_stratum_transcoder application
transcoder_host_address = "127.0.0.1:7879"

[mining_node]
# Number of mining threads
# Default: number of logical CPU cores
Expand All @@ -515,3 +519,7 @@ monerod_password = ""
# to true
# Default: 30 seconds
#validate_tip_timeout_sec=30

# Stratum Mode configuration
# mining_pool_address = "miningcore.tarilabs.com:3052"
# mining_wallet_address = "YOUR_WALLET_PUBLIC_KEY"
2 changes: 1 addition & 1 deletion common/src/configuration/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ fn convert_node_config(
.map_err(|e| ConfigurationError::new(&key, &e.to_string()))
})?;

let key = config_string("merge_mining_proxy", &net_str, "transcoder_host_address");
let key = config_string("stratum_transcoder", &net_str, "transcoder_host_address");
let transcoder_host_address = cfg
.get_str(&key)
.map_err(|e| ConfigurationError::new(&key, &e.to_string()))
Expand Down
16 changes: 11 additions & 5 deletions common/src/configuration/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,21 @@ pub fn default_config(bootstrap: &ConfigBootstrap) -> Config {
set_transport_defaults(&mut cfg).unwrap();
set_merge_mining_defaults(&mut cfg);
set_mining_node_defaults(&mut cfg);
set_stratum_transcoder_defaults(&mut cfg);

cfg
}

fn set_stratum_transcoder_defaults(cfg: &mut Config) {
cfg.set_default("stratum_transcoder.mainnet.transcoder_host_address", "127.0.0.1:7879")
.unwrap();
cfg.set_default(
"stratum_transcoder.weatherwax.transcoder_host_address",
"127.0.0.1:7879",
)
.unwrap();
}

fn set_merge_mining_defaults(cfg: &mut Config) {
cfg.set_default(
"merge_mining_proxy.mainnet.monerod_url",
Expand All @@ -254,8 +265,6 @@ fn set_merge_mining_defaults(cfg: &mut Config) {
.unwrap();
cfg.set_default("merge_mining_proxy.mainnet.proxy_host_address", "127.0.0.1:7878")
.unwrap();
cfg.set_default("merge_mining_proxy.mainnet.transcoder_host_address", "127.0.0.1:7879")
.unwrap();
cfg.set_default("merge_mining_proxy.mainnet.monerod_use_auth", "false")
.unwrap();
cfg.set_default("merge_mining_proxy.mainnet.monerod_username", "")
Expand All @@ -264,16 +273,13 @@ fn set_merge_mining_defaults(cfg: &mut Config) {
.unwrap();
cfg.set_default("merge_mining_proxy.mainnet.wait_for_initial_sync_at_startup", true)
.unwrap();

cfg.set_default(
"merge_mining_proxy.weatherwax.monerod_url",
"http://monero-stagenet.exan.tech:38081",
)
.unwrap();
cfg.set_default("merge_mining_proxy.weatherwax.proxy_host_address", "127.0.0.1:7878")
.unwrap();
cfg.set_default("merge_mining_proxy.mainnet.transcoder_host_address", "127.0.0.1:7879")
.unwrap();
cfg.set_default("merge_mining_proxy.weatherwax.proxy_submit_to_origin", true)
.unwrap();
cfg.set_default("merge_mining_proxy.weatherwax.monerod_use_auth", "false")
Expand Down
22 changes: 11 additions & 11 deletions integration_tests/features/WalletMonitoring.feature
Original file line number Diff line number Diff line change
Expand Up @@ -70,23 +70,23 @@ Feature: Wallet Monitoring
And I have mining node MINER2 connected to base node NODE2 and wallet WALLET2

When I co-mine <numBlocks> blocks via merge mining proxy PROXY1 and mining node MINER2
Then node NODE1 is at the same height as node NODE2
Then node SEED_A is at the same height as node NODE1
# This wait is here to give a chance for re-orgs to settle out
Then I wait 30 seconds
Then all nodes are on the same chain at height <numBlocks>

And mining node MINER_SEED_A mines 5 blocks
Then all nodes are at the same height as node SEED_A
Then all nodes are on the same chain at height <endBlocks>

When I wait 1 seconds
Then wallets WALLET1,WALLET2 account for all valid spendable coinbase transactions on the blockchain
Then wallets WALLET1,WALLET2 should have <numBlocks> spendable coinbase outputs
@critical
Examples:
| numBlocks |
| 10 |
| 100 |
| numBlocks | endBlocks |
| 10 | 15 |
| 100 | 105 |

@long-running
Examples:
| numBlocks |
| 1000 |
| 4500 |

| numBlocks | endBlocks |
| 1000 | 1005 |
| 4500 | 4505 |
11 changes: 6 additions & 5 deletions integration_tests/features/support/steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,7 @@ Then(
await this.forEachClientAsync(async (client, name) => {
await waitFor(async () => client.getTipHeight(), height, 115 * 1000);
const currTip = await client.getTipHeader();
console.log("the node is at tip ", currTip);
expect(currTip.height).to.equal(height);
if (!tipHash) {
tipHash = currTip.hash.toString("hex");
Expand Down Expand Up @@ -2517,9 +2518,9 @@ Then(
);

Then(
/wallets ([A-Za-z0-9,]+) account for all valid spendable coinbase transactions on the blockchain/,
/wallets ([A-Za-z0-9,]+) should have (.*) spendable coinbase outputs/,
{ timeout: 610 * 1000 },
async function (wallets) {
async function (wallets, amountOfCoinBases) {
const walletClients = wallets
.split(",")
.map((wallet) => this.getWallet(wallet).getClient());
Expand All @@ -2536,7 +2537,7 @@ Then(
console.log(client.name, "count", count);
spendableCoinbaseCount += count;
}
return spendableCoinbaseCount === this.lastResult;
return spendableCoinbaseCount.toString() === amountOfCoinBases;
},
true,
600 * 1000,
Expand All @@ -2552,10 +2553,10 @@ Then(
"with",
spendableCoinbaseCount,
"being valid and Mined_Confirmed, expected",
this.lastResult,
amountOfCoinBases,
"\n"
);
expect(spendableCoinbaseCount).to.equal(this.lastResult);
expect(spendableCoinbaseCount.toString()).to.equal(amountOfCoinBases);
}
);

Expand Down
2 changes: 1 addition & 1 deletion integration_tests/helpers/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ function createEnv(
`TARI_MERGE_MINING_PROXY__${network}__PROXY_HOST_ADDRESS`
] = `${proxyFullAddress}`;
configEnvs[
`TARI_MERGE_MINING_PROXY__${network}__TRANSCODER_HOST_ADDRESS`
`TARI_STRATUM_TRANSCODER__${network}__TRANSCODER_HOST_ADDRESS`
] = `${transcoderFullAddress}`;
configEnvs[`TARI_BASE_NODE__${network}__TRANSPORT`] = "tcp";
configEnvs[`TARI_WALLET__${network}__TRANSPORT`] = "tcp";
Expand Down
7 changes: 5 additions & 2 deletions integration_tests/helpers/mergeMiningProxyClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,12 @@ class MergeMiningProxyClient {
const template = await this.getBlockTemplate();
const block = template.blocktemplate_blob;
// Need to insert a nonce into the template as xmrig would for it to be a valid block.
await this.submitBlock(block);
tipHeight = parseInt(await this.baseNodeClient.getTipHeight());
} while (tipHeight < height);
if (tipHeight >= height) {
break;
}
await this.submitBlock(block);
} while (tipHeight + 1 < height);
return await this.baseNodeClient.getTipHeight();
}
}
Expand Down
6 changes: 4 additions & 2 deletions integration_tests/helpers/transactionBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,15 @@ class TransactionBuilder {
flags: 0,
maturity: 0,
};
let key = Math.floor(Math.random() * 500 + 1);
let key = Math.floor(Math.random() * 500000000000 + 1);
let privateKey = Buffer.from(toLittleEndian(key, 256)).toString("hex");
let scriptKey = Math.floor(Math.random() * 500000000000 + 1);
let scriptPrivateKey = Buffer.from(toLittleEndian(scriptKey, 256)).toString(
"hex"
);
let scriptOffsetPrivateKeyNum = Math.floor(Math.random() * 500 + 1);
let scriptOffsetPrivateKeyNum = Math.floor(
Math.random() * 500000000000 + 1
);
let scriptOffsetPrivateKey = Buffer.from(
toLittleEndian(scriptOffsetPrivateKeyNum, 256)
).toString("hex");
Expand Down
Loading

0 comments on commit 994ea26

Please sign in to comment.