Currently, if a user tries to Kill/Fulfill/Accept an issue that does not exist, the code queries the API to see if that issue URL exists. If it doesn't, it will pop up a red error banner to the user.
While this works, it might be more thourough to also check the blockchain if the bounty exists. In theory, the database should always be syncing with web3 on any changes, so this shouldn't be an issue.
If we were to do this, the flow would have to be:
standard_bounties_id and use web3 to query getBounty(_bountyId).@jasonrhaas
went through kill_bounty.js
I'm guessing the code would sort of look like this as everything else is available
bounty.getBounty(bountyId, (error, result) => {
if(error || result == null)
errormsg = "No active funded issue found at this address. Are you sure this is an active funded issue?";
});
A lil confused here though, under what scenario would the bounty not exist on the blockhain but on our backend API ? (or is it just a safety precaution )
^ @mbeacom / @owocki on the off chance @jasonrhaas is held up
@thelostone-mc The database should always be sync'ed up with the blockchain. It might be possible for it to get out of sync if the contract was altered somewhere outside of gitcoin. Also, when #128 is implemented I think that should also help to make sure the DB and the blockchain are always in sync.
If a user closes their browser window on the pending confirmation page, it will get out of sync. This is an especially pervasive issue in times of network slowness.
Most helpful comment
If a user closes their browser window on the pending confirmation page, it will get out of sync. This is an especially pervasive issue in times of network slowness.