Merge pull request #3646 from Undeemiss/contract-already-solved-check

CODINGCONTRACT: Fix #3391 Double contract reward exploit
This commit is contained in:
hydroflame 2022-05-11 20:49:07 -04:00 committed by GitHub
commit d70d91b7b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -463,6 +463,12 @@ export class Terminal implements ITerminal {
this.contractOpen = true; this.contractOpen = true;
const res = await contract.prompt(); const res = await contract.prompt();
//Check if the contract still exists by the time the promise is fullfilled
if (serv.getContract(contractName) == null) {
this.contractOpen = false;
return this.error("Contract no longer exists (Was it solved by a script?)");
}
switch (res) { switch (res) {
case CodingContractResult.Success: case CodingContractResult.Success:
if (contract.reward !== null) { if (contract.reward !== null) {