stratisproject / StratisBitcoinFullNode

Bitcoin full node in C#
https://stratisplatform.com
MIT License
788 stars 312 forks source link

Can't use PosConsensus with SmartContracts #1633

Closed damien-r closed 6 years ago

damien-r commented 6 years ago

Hi,

If I use the following FullNodeBuilder:

    node = new FullNodeBuilder()
                       .UseNodeSettings(nodeSettings)
                       .UseBlockStore()
                       .UsePosConsensus()
                       .UseMempool()
                       .UseWallet()
                       .AddPowPosMining()
                       .UseApi()
                       .AddRPC()
                       .AddSmartContracts()
                       .UseReflectionExecutor()
                       .Build();

I got some errors. First one, in BlockDefinition.cs, line 255: var coinviewRule = this.ConsensusLoop.ConsensusRules.GetRule<CoinViewRule>();

System.InvalidOperationException: 'Sequence contains more than one matching element'

Caused by the fact that the rules contains a SmartContractCoinviewRule and a PosCoinviewRule.

This can be corrected by changing the line 49 of SmartContractRuleRegistration.cs to ignore PosCoinviewRule too.

The problem with that is, when I do that, I have an error "proof of work too heigh" and I do not understand this error.

Thanks in advance.

EDIT: I use the branch sc-alpha

fassadlr commented 6 years ago

Hi @damien-r , please note that our smart contract feature does not yet support the proof of stake protocol but will do so in later releases.