Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: RpcImpl should broadcast PoS blocks in submitsiganture() #1056

Merged
merged 1 commit into from
Oct 30, 2019
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
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public UnityChain getBlockchain() {
return aionHub.getBlockchain();
}

public synchronized ImportResult addNewMinedBlock(AionBlock block) {
public synchronized ImportResult addNewBlock(Block block) {
ImportResult importResult = this.aionHub.getBlockchain().tryToConnect(block);

if (importResult == ImportResult.IMPORTED_BEST) {
Expand Down
2 changes: 1 addition & 1 deletion modAionImpl/src/org/aion/zero/impl/pow/AionPoW.java
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ protected synchronized void processSolution(AionPowSolution solution) {
}

// This can be improved
ImportResult importResult = AionImpl.inst().addNewMinedBlock(block);
ImportResult importResult = AionImpl.inst().addNewBlock(block);

// Check that the new block was successfully added
if (importResult.isSuccessful()) {
Expand Down
2 changes: 1 addition & 1 deletion modApiServer/src/org/aion/api/server/rpc/ApiWeb3Aion.java
Original file line number Diff line number Diff line change
Expand Up @@ -2647,7 +2647,7 @@ public RpcMsg stratum_submitblock(Object _params) {

// Directly submit to chain for new due to delays using event, explore event
// submission again
ImportResult importResult = AionImpl.inst().addNewMinedBlock(bestBlock);
ImportResult importResult = AionImpl.inst().addNewBlock(bestBlock);
if (importResult.isSuccessful()) {
templateMap.remove(key);
LOG.info(
Expand Down
8 changes: 4 additions & 4 deletions modApiServer/src/org/aion/api/server/rpc2/RpcImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
import org.aion.api.server.rpc2.autogen.errors.NullReturnRpcException;
import org.aion.log.AionLoggerFactory;
import org.aion.log.LogEnum;
import org.aion.zero.impl.blockchain.IAionChain;
import org.aion.zero.impl.blockchain.AionImpl;
import org.aion.zero.impl.core.ImportResult;
import org.aion.zero.impl.types.StakingBlock;
import org.aion.zero.impl.types.StakingBlockHeader;

public class RpcImpl implements Rpc {

private IAionChain ac;
private AionImpl ac;

RpcImpl(final IAionChain aionChain) {
RpcImpl(final AionImpl aionChain) {
if (aionChain == null) {
throw new NullPointerException("RpcImpl construct aionChain is null");
}
Expand Down Expand Up @@ -104,7 +104,7 @@ public boolean submitsignature(byte[] signature, byte[] sealhash) throws NullRet
}

block.seal(signature, block.getHeader().getSigningPublicKey());
ImportResult result = ac.getBlockchain().tryToConnect(block);
ImportResult result = ac.addNewBlock(block);

boolean sealed = (result == ImportResult.IMPORTED_BEST || result == ImportResult.IMPORTED_NOT_BEST);
if (sealed) {
Expand Down