Skip to content

Commit

Permalink
Fix the bug that getnextblockvalidators return empty when there is no…
Browse files Browse the repository at this point in the history
… votes. (neo-project#445)

* [RpcServer] Querying contracts by ID/name (neo-project#378)

* fixed-bug-1021

* Update src/RpcServer/RpcServer.SmartContract.cs

* 😂

* draft

* draft

* update

* fixed bug with decimal of GAS consumed in invokefunction/invokescript

* remove modify of invokescript

* Querying contracts by ID/name, server side

* update

* Enable using native.name for search

Enable using native.name for search

* Using keyword instead of addressOrScriptHash

* revert

* _initialize

* split

* update

* Update exception message in ApplicationLog

* Update src/ApplicationLogs/LogReader.cs

Co-authored-by: Luchuan <luchuan@ngd.neo.org>

* update

* a

* More fix

* fix

* Fixed UT

* Simplify Code

* Simplify Code 2

* Update RpcServer

* update

Co-authored-by: Shargon <shargon@gmail.com>
Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com>
Co-authored-by: superboyiii <573504781@qq.com>
Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>
Co-authored-by: Luchuan <luchuan@ngd.neo.org>

* MPT in StateService from core (neo-project#410)

* Unify GetUnclaimedGas and GetWalletUnclaimedGas with decimal (neo-project#413)

* Unify GetUnclaimedGas and GetWalletUnclaimedGas with decimal

* fix

* Fixed UT (Neo CI01089) (neo-project#416)

* [RpcServer] Querying contracts by ID/name (neo-project#378)

* fixed-bug-1021

* Update src/RpcServer/RpcServer.SmartContract.cs

* 😂

* draft

* draft

* update

* fixed bug with decimal of GAS consumed in invokefunction/invokescript

* remove modify of invokescript

* Querying contracts by ID/name, server side

* update

* Enable using native.name for search

Enable using native.name for search

* Using keyword instead of addressOrScriptHash

* revert

* _initialize

* split

* update

* Update exception message in ApplicationLog

* Update src/ApplicationLogs/LogReader.cs

Co-authored-by: Luchuan <luchuan@ngd.neo.org>

* update

* a

* More fix

* fix

* Fixed UT

* Simplify Code

* Simplify Code 2

* Update RpcServer

* update

Co-authored-by: Shargon <shargon@gmail.com>
Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com>
Co-authored-by: superboyiii <573504781@qq.com>
Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>
Co-authored-by: Luchuan <luchuan@ngd.neo.org>

* MPT in StateService from core (neo-project#410)

* Unify GetUnclaimedGas and GetWalletUnclaimedGas with decimal (neo-project#413)

* Unify GetUnclaimedGas and GetWalletUnclaimedGas with decimal

* fix

* Fixed UT (Neo CI01089)

Co-authored-by: Shargon <shargon@gmail.com>
Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com>
Co-authored-by: superboyiii <573504781@qq.com>
Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>
Co-authored-by: Luchuan <luchuan@ngd.neo.org>
Co-authored-by: ZhangTao <ztgoforit@163.com>

* Nep17 (neo-project#412)

* [RpcServer] Querying contracts by ID/name (neo-project#378)

* fixed-bug-1021

* Update src/RpcServer/RpcServer.SmartContract.cs

* 😂

* draft

* draft

* update

* fixed bug with decimal of GAS consumed in invokefunction/invokescript

* remove modify of invokescript

* Querying contracts by ID/name, server side

* update

* Enable using native.name for search

Enable using native.name for search

* Using keyword instead of addressOrScriptHash

* revert

* _initialize

* split

* update

* Update exception message in ApplicationLog

* Update src/ApplicationLogs/LogReader.cs

Co-authored-by: Luchuan <luchuan@ngd.neo.org>

* update

* a

* More fix

* fix

* Fixed UT

* Simplify Code

* Simplify Code 2

* Update RpcServer

* update

Co-authored-by: Shargon <shargon@gmail.com>
Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com>
Co-authored-by: superboyiii <573504781@qq.com>
Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>
Co-authored-by: Luchuan <luchuan@ngd.neo.org>

* String Substitution

* Modify filename and name methods

* update

* update

* Update src/RpcClient/Models/RpcNep5TokenInfo.cs

Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>

* Update src/RpcClient/Nep17API.cs

Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>

* MPT in StateService from core (neo-project#410)

* Unify GetUnclaimedGas and GetWalletUnclaimedGas with decimal (neo-project#413)

* Unify GetUnclaimedGas and GetWalletUnclaimedGas with decimal

* fix

* Fixed UT (Neo CI01089)

* Update Nep17API.cs

* Update README.md

Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com>

* update filename

* Fix UT

* Format

* fix

* update

* update UT

* Add Unit Tests

* update

Co-authored-by: Shargon <shargon@gmail.com>
Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com>
Co-authored-by: superboyiii <573504781@qq.com>
Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>
Co-authored-by: Luchuan <luchuan@ngd.neo.org>
Co-authored-by: ZhangTao <ztgoforit@163.com>

* merge

* clear

* Transfer bug fix (neo-project#429)

* [RpcServer] Querying contracts by ID/name (neo-project#378)

* fixed-bug-1021

* Update src/RpcServer/RpcServer.SmartContract.cs

* 😂

* draft

* draft

* update

* fixed bug with decimal of GAS consumed in invokefunction/invokescript

* remove modify of invokescript

* Querying contracts by ID/name, server side

* update

* Enable using native.name for search

Enable using native.name for search

* Using keyword instead of addressOrScriptHash

* revert

* _initialize

* split

* update

* Update exception message in ApplicationLog

* Update src/ApplicationLogs/LogReader.cs

Co-authored-by: Luchuan <luchuan@ngd.neo.org>

* update

* a

* More fix

* fix

* Fixed UT

* Simplify Code

* Simplify Code 2

* Update RpcServer

* update

Co-authored-by: Shargon <shargon@gmail.com>
Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com>
Co-authored-by: superboyiii <573504781@qq.com>
Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>
Co-authored-by: Luchuan <luchuan@ngd.neo.org>

* MPT in StateService from core (neo-project#410)

* Unify GetUnclaimedGas and GetWalletUnclaimedGas with decimal (neo-project#413)

* Unify GetUnclaimedGas and GetWalletUnclaimedGas with decimal

* fix

* Fixed UT (Neo CI01089) (neo-project#416)

* [RpcServer] Querying contracts by ID/name (neo-project#378)

* fixed-bug-1021

* Update src/RpcServer/RpcServer.SmartContract.cs

* 😂

* draft

* draft

* update

* fixed bug with decimal of GAS consumed in invokefunction/invokescript

* remove modify of invokescript

* Querying contracts by ID/name, server side

* update

* Enable using native.name for search

Enable using native.name for search

* Using keyword instead of addressOrScriptHash

* revert

* _initialize

* split

* update

* Update exception message in ApplicationLog

* Update src/ApplicationLogs/LogReader.cs

Co-authored-by: Luchuan <luchuan@ngd.neo.org>

* update

* a

* More fix

* fix

* Fixed UT

* Simplify Code

* Simplify Code 2

* Update RpcServer

* update

Co-authored-by: Shargon <shargon@gmail.com>
Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com>
Co-authored-by: superboyiii <573504781@qq.com>
Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>
Co-authored-by: Luchuan <luchuan@ngd.neo.org>

* MPT in StateService from core (neo-project#410)

* Unify GetUnclaimedGas and GetWalletUnclaimedGas with decimal (neo-project#413)

* Unify GetUnclaimedGas and GetWalletUnclaimedGas with decimal

* fix

* Fixed UT (Neo CI01089)

Co-authored-by: Shargon <shargon@gmail.com>
Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com>
Co-authored-by: superboyiii <573504781@qq.com>
Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>
Co-authored-by: Luchuan <luchuan@ngd.neo.org>
Co-authored-by: ZhangTao <ztgoforit@163.com>

* Nep17 (neo-project#412)

* [RpcServer] Querying contracts by ID/name (neo-project#378)

* fixed-bug-1021

* Update src/RpcServer/RpcServer.SmartContract.cs

* 😂

* draft

* draft

* update

* fixed bug with decimal of GAS consumed in invokefunction/invokescript

* remove modify of invokescript

* Querying contracts by ID/name, server side

* update

* Enable using native.name for search

Enable using native.name for search

* Using keyword instead of addressOrScriptHash

* revert

* _initialize

* split

* update

* Update exception message in ApplicationLog

* Update src/ApplicationLogs/LogReader.cs

Co-authored-by: Luchuan <luchuan@ngd.neo.org>

* update

* a

* More fix

* fix

* Fixed UT

* Simplify Code

* Simplify Code 2

* Update RpcServer

* update

Co-authored-by: Shargon <shargon@gmail.com>
Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com>
Co-authored-by: superboyiii <573504781@qq.com>
Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>
Co-authored-by: Luchuan <luchuan@ngd.neo.org>

* String Substitution

* Modify filename and name methods

* update

* update

* Update src/RpcClient/Models/RpcNep5TokenInfo.cs

Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>

* Update src/RpcClient/Nep17API.cs

Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>

* MPT in StateService from core (neo-project#410)

* Unify GetUnclaimedGas and GetWalletUnclaimedGas with decimal (neo-project#413)

* Unify GetUnclaimedGas and GetWalletUnclaimedGas with decimal

* fix

* Fixed UT (Neo CI01089)

* Update Nep17API.cs

* Update README.md

Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com>

* update filename

* Fix UT

* Format

* fix

* update

* update UT

* Add Unit Tests

* update

Co-authored-by: Shargon <shargon@gmail.com>
Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com>
Co-authored-by: superboyiii <573504781@qq.com>
Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>
Co-authored-by: Luchuan <luchuan@ngd.neo.org>
Co-authored-by: ZhangTao <ztgoforit@163.com>

* merge

* fixed bug

* clear

* UT

* Add a little code coverage

Co-authored-by: Shargon <shargon@gmail.com>
Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com>
Co-authored-by: superboyiii <573504781@qq.com>
Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>
Co-authored-by: Luchuan <luchuan@ngd.neo.org>
Co-authored-by: ZhangTao <ztgoforit@163.com>

* Preview4 (neo-project#430)

* Preview4

* Remove syslog in README.md

* dotnet 5.0 (neo-project#407)

* CI01123 (neo-project#435)

* Fix dotnet5 (neo-project#442)

* Update RpcServer.Blockchain.cs

Co-authored-by: 陈志同 <chenzhitong12@hotmail.com>
Co-authored-by: Shargon <shargon@gmail.com>
Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com>
Co-authored-by: superboyiii <573504781@qq.com>
Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>
Co-authored-by: Luchuan <luchuan@ngd.neo.org>
Co-authored-by: ZhangTao <ztgoforit@163.com>
Co-authored-by: Erik Zhang <erik@neo.org>
Co-authored-by: Shine Li <bfshm@qq.com>
  • Loading branch information
10 people authored and joeqian10 committed Apr 7, 2021
1 parent 8f016ac commit a6340ff
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions src/RpcServer/RpcServer.Blockchain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,29 @@ protected virtual JObject GetNextBlockValidators(JArray _params)
{
using SnapshotView snapshot = Blockchain.Singleton.GetSnapshot();
var validators = NativeContract.NEO.GetNextBlockValidators(snapshot);
return NativeContract.NEO.GetCandidates(snapshot).Select(p =>
var candidates = NativeContract.NEO.GetCandidates(snapshot);
if (candidates.Length > 0)
{
JObject validator = new JObject();
validator["publickey"] = p.PublicKey.ToString();
validator["votes"] = p.Votes.ToString();
validator["active"] = validators.Contains(p.PublicKey);
return validator;
}).ToArray();
return candidates.Select(p =>
{
JObject validator = new JObject();
validator["publickey"] = p.PublicKey.ToString();
validator["votes"] = p.Votes.ToString();
validator["active"] = validators.Contains(p.PublicKey);
return validator;
}).ToArray();
}
else
{
return validators.Select(p =>
{
JObject validator = new JObject();
validator["publickey"] = p.ToString();
validator["votes"] = 0;
validator["active"] = true;
return validator;
}).ToArray();
}
}

[RpcMethod]
Expand Down

0 comments on commit a6340ff

Please sign in to comment.