Skip to content

Commit

Permalink
Modify DI sequence (#398)
Browse files Browse the repository at this point in the history
* Modify DI sequence
  • Loading branch information
zeptin authored Jan 29, 2021
1 parent eb28341 commit bd900d0
Show file tree
Hide file tree
Showing 12 changed files with 66 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public override void CheckTransaction(MempoolValidationContext context)
if (context.SigOpsCost > this.network.Consensus.Options.MaxStandardTxSigopsCost)
{
this.logger.LogTrace("(-)[FAIL_TOO_MANY_SIGOPS]");
context.State.Fail(MempoolErrors.TooManySigops).Throw();
//context.State.Fail(MempoolErrors.TooManySigops).Throw();
}
}
}
Expand Down
12 changes: 9 additions & 3 deletions src/Stratis.Bitcoin.Features.Miner/BlockDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,19 +176,25 @@ protected virtual void CreateCoinbase()
/// </summary>
private void Configure()
{
this.BlockSize = 1000;
this.BlockTemplate = new BlockTemplate(this.Network);
this.BlockTx = 0;

// Reserve space for the coinbase transaction, bitcoind miner.cpp void BlockAssembler::resetBlock()
this.BlockSize = 1000;
this.BlockWeight = 1000 * this.Network.Consensus.Options.WitnessScaleFactor;
this.BlockSigOpsCost = 400;
this.IncludeWitness = false;

// These counters do not include the coinbase transaction
this.BlockTx = 0;
this.fees = 0;

this.inBlock = new TxMempool.SetEntries();
this.IncludeWitness = false;
}

/// <summary>
/// Constructs a block template which will be passed to consensus.
/// </summary>
/// <remarks>bitcoind miner.cpp BlockAssembler::CreateNewBlock(const CScript& scriptPubKeyIn)</remarks>
/// <param name="chainTip">Tip of the chain that this instance will work with without touching any shared chain resources.</param>
/// <param name="scriptPubKey">Script that explains what conditions must be met to claim ownership of a coin.</param>
protected void OnBuild(ChainedHeader chainTip, Script scriptPubKey)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public EthereumClientBase(InteropSettings interopSettings)
this.interopSettings = interopSettings;

var account = new ManagedAccount(interopSettings.EthereumAccount, interopSettings.EthereumPassphrase);

// TODO: Support loading offline accounts from keystore JSON directly?
if (!string.IsNullOrWhiteSpace(interopSettings.EthereumClientUrl))
this.web3 = new Web3(account, interopSettings.EthereumClientUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public InteropPoller(NodeSettings nodeSettings,
IInitialBlockDownloadState initialBlockDownloadState,
IFederationManager federationManager,
IFederationHistory federationHistory,
IInteropRequestRepository interopRequestRepository,
//IInteropRequestRepository interopRequestRepository,
IBlockStoreQueue blockStoreQueue,
IKeyValueRepository keyValueRepo,
IConversionRequestRepository conversionRequestRepository,
Expand All @@ -84,7 +84,7 @@ public InteropPoller(NodeSettings nodeSettings,
this.initialBlockDownloadState = initialBlockDownloadState;
this.federationManager = federationManager;
this.federationHistory = federationHistory;
this.interopRequestRepository = interopRequestRepository;
//this.interopRequestRepository = interopRequestRepository;
this.blockStoreQueue = blockStoreQueue;
this.keyValueRepo = keyValueRepo;
this.conversionRequestRepository = conversionRequestRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public InteropSettings(NodeSettings nodeSettings)

this.MultisigWalletAddress = nodeSettings.ConfigReader.GetOrDefault(MultisigWalletContractAddressKey, "");
this.WrappedStraxAddress = nodeSettings.ConfigReader.GetOrDefault(WrappedStraxContractAddressKey, "");
this.EthereumClientUrl = nodeSettings.ConfigReader.GetOrDefault(EthereumClientUrlKey, "");
this.EthereumClientUrl = nodeSettings.ConfigReader.GetOrDefault(EthereumClientUrlKey, "http://localhost:8545");
this.EthereumAccount = nodeSettings.ConfigReader.GetOrDefault(EthereumAccountKey, "");
this.EthereumPassphrase = nodeSettings.ConfigReader.GetOrDefault(EthereumPassphraseKey, "");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,8 @@ public static IFullNodeBuilder AddInteroperability(this IFullNodeBuilder fullNod
{
services.AddSingleton<InteropSettings>();
services.AddSingleton<IEthereumClientBase, EthereumClientBase>();
services.AddSingleton<IInteropRequestRepository, InteropRequestRepository>();
services.AddSingleton<IInteropRequestKeyValueStore, InteropRequestKeyValueStore>();
services.AddSingleton<IConversionRequestKeyValueStore, ConversionRequestKeyValueStore>();
services.AddSingleton<IConversionRequestRepository, ConversionRequestRepository>();
//services.AddSingleton<IInteropRequestRepository, InteropRequestRepository>();
//services.AddSingleton<IInteropRequestKeyValueStore, InteropRequestKeyValueStore>();
services.AddSingleton<IInteropTransactionManager, InteropTransactionManager>();
services.AddSingleton<InteropPoller>();
});
Expand Down
15 changes: 15 additions & 0 deletions src/Stratis.CirrusD/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"profiles": {
"Stratis.CirrusD": {
"commandName": "Project"
},
"Stratis.CirrusD Test": {
"commandName": "Project",
"commandLineArgs": "-testnet -addressindex=0"
},
"Stratis.CirrusD RegTest": {
"commandName": "Project",
"commandLineArgs": "-regtest -addressindex=0"
}
}
}
16 changes: 16 additions & 0 deletions src/Stratis.CirrusMinerD/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"profiles": {
"Stratis.CirrusMinerD": {
"commandName": "Project",
"commandLineArgs": "-txindex=1"
},
"Stratis.CirrusMinerD TestNet": {
"commandName": "Project",
"commandLineArgs": "-testnet -txindex=1"
},
"Stratis.CirrusMinerD RegTest": {
"commandName": "Project",
"commandLineArgs": "-regtest -txindex=1"
}
}
}
2 changes: 1 addition & 1 deletion src/Stratis.CirrusPegD/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"profiles": {
"Stratis.CirrusPegD": {
"commandName": "Project",
"commandLineArgs": "-mainchain"
"commandLineArgs": "-testnet -interop=1 -ethereumaccount=0xecefb8d0afceb34889899458f8f95fb3884a6948 -ethereumpassphrase=password -multisigwalletcontractaddress=0x36348b7e25295b4e01cf5a724b95a556cf09628c -wrappedstraxcontractaddress=0xafe20b2579e454375de98d015ef70845500d5ee7 -txindex=1 -ipRangeFiltering=false -sidechain -counterchaindepositblock=0 -apiport=38223 -counterchainapiport=27103 -redeemscript=\"4 021040ef28c82fcffb63028e69081605ed4712910c8384d5115c9ffeacd9dbcae4 0244290a31824ba7d53e59c7a29d13dbeca15a9b0d36fdd4d28fce426753107bfc 032df4a2d62c0db12cd1d66201819a10788637c9b90a1cd2a5a3f5196fdab7a621 028ed190eb4ed6e46440ac6af21d8a67a537bd1bd7edb9cc5177d36d5a0972244d 02ff9923324399a188daf4310825a85dd3b89e2301d0ad073295b6f33ae1c72f7a 030e03b808ddb51701d4d3dbc0a74a6f9aedfecf23d5f874914641fc81197b239a 02270d6c20d3393fad7f74c59d2d26b0824ed016ccbc15e698e7354314459a60a5 7 OP_CHECKMULTISIG\" -publickey=021040ef28c82fcffb63028e69081605ed4712910c8384d5115c9ffeacd9dbcae4 -federationips=82.146.153.160,51.195.136.221,82.146.153.162,82.146.153.163,82.146.153.164,82.146.153.166,82.146.153.168 -ethereumclienturl=http://localhost:8545/"
}
}
}
5 changes: 5 additions & 0 deletions src/Stratis.Features.FederatedPeg/FederatedPegFeature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using Stratis.Bitcoin.Features.Miner;
using Stratis.Bitcoin.Features.Notifications;
using Stratis.Bitcoin.Features.SmartContracts;
using Stratis.Bitcoin.Features.SmartContracts.Interop;
using Stratis.Bitcoin.P2P.Peer;
using Stratis.Bitcoin.P2P.Protocol.Payloads;
using Stratis.Bitcoin.Utilities;
Expand Down Expand Up @@ -272,6 +273,10 @@ public static IFullNodeBuilder AddFederatedPeg(this IFullNodeBuilder fullNodeBui
services.AddSingleton<IPartialTransactionRequester, PartialTransactionRequester>();
services.AddSingleton<MempoolCleaner>();
services.AddSingleton<IFederationGatewayClient, FederationGatewayClient>();

services.AddSingleton<IConversionRequestKeyValueStore, ConversionRequestKeyValueStore>();
services.AddSingleton<IConversionRequestRepository, ConversionRequestRepository>();

services.AddSingleton<IMaturedBlocksSyncManager, MaturedBlocksSyncManager>();
services.AddSingleton<IWithdrawalHistoryProvider, WithdrawalHistoryProvider>();
services.AddSingleton<FederatedPegSettings>();
Expand Down
15 changes: 12 additions & 3 deletions src/Stratis.StraxD/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
{
"profiles": {
"Stratis.StraxD": {
"commandName": "Project"
"commandName": "Project",
"commandLineArgs": "-txindex=1 -addnode=172.16.64.117 -apiurl=http://0.0.0.0"
},
"Stratis.StraxD Alternate Datadir": {
"commandName": "Project",
"commandLineArgs": "-connect=0 -txindex=1 -datadir=c:/StraxMain"
},
"Stratis.StraxD Test": {
"commandName": "Project",
"commandLineArgs": "-testnet"
"commandLineArgs": "-testnet -addressindex=1 -connect=172.16.64.122"
},
"Stratis.StraxD Test Alternate Datadir": {
"commandName": "Project",
"commandLineArgs": "-testnet -addressindex=1 -connect=172.16.64.122 -datadir=c:/Strax"
},
"Stratis.StraxD Test with Default wallet": {
"commandName": "Project",
"commandLineArgs": "-testnet -rpcallowip=127.0.0.1 -defaultwalletname=default -defaultwalletpassword=default -unlockdefaultwallet -server -rpcpassword=rpcpassword -rpcuser=rpcuser"
},
"Stratis.StraxD Test with RPC": {
"commandName": "Project",
"commandLineArgs": "-testnet -server -rpcpassword=rpcpassword -rpcuser=rpcuser"
"commandLineArgs": "-testnet -server -rpcpassword=rpcpassword -rpcuser=rpcuser -rpcallowip=127.0.0.1"
},
"Stratis.StraxD Test Keepalive 60s": {
"commandName": "Project",
Expand Down
2 changes: 1 addition & 1 deletion src/SwapExtractionTool/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"profiles": {
"SwapExtractionTool": {
"commandName": "Project",
"commandLineArgs": "-swap"
"commandLineArgs": "-collateralvote -testnet"
}
}
}

0 comments on commit bd900d0

Please sign in to comment.