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

Various cleanup, reindexing and resolving LOCK issue #68

Merged
merged 21 commits into from
Jun 1, 2015

Conversation

dexX7
Copy link
Member

@dexX7 dexX7 commented May 30, 2015

Notable changes:

  • Removal of unused, or old code, which very likely isn't going to be used anymore
  • Formatting, restructuring here and there
  • Moving code from headers into cpp files
  • Split alert/notification code
  • Enable block disconnect handlers during reindex, and wipe DBs during reindex

Alert related:

  • Authorize mainnet address: 1dexX7zmPen1yBz2H9ZF62AK5TGGqGTZH (resolves Grant @dexx7 alert rights #53)
  • Authorize testnet address: mk5SSx4kdexENHzLxk9FLhQdbbBexHUFTW (resolves Grant @dexx7 alert rights #53)
  • Alert payloads can be created via CreatePayload_OmniCoreAlert()
  • There is a hidden RPC call "sendalert_OMNI" to create alerts
  • "-alertignoresender=address" can be used to backlist specific alert senders
  • "-alertallowsender=address" can be used to whitelist specific alert senders
  • "-alertallowsender=any" can be used to consider any source as authorized (for tests!)

Fixes:

@dexX7 dexX7 force-pushed the oc-0.10-cleanup-pulldown branch from 4287756 to c1d4d56 Compare May 30, 2015 22:55
@dexX7
Copy link
Member Author

dexX7 commented May 31, 2015

Updated. The following items were added:

Alert related:

  • Authorize mainnet address: 1dexX7zmPen1yBz2H9ZF62AK5TGGqGTZH (mine)
  • Authorize testnet address: mk5SSx4kdexENHzLxk9FLhQdbbBexHUFTW (mine)
  • Alert payloads can be created via CreatePayload_OmniCoreAlert()
  • There is a hidden RPC call "sendalert_OMNI" to create alerts
  • "-alertignoresender=address" can be used to backlist specific alert senders
  • "-alertallowsender=address" can be used to whitelist specific alert senders
  • "-alertallowsender=any" can be used to consider any source as authorized (for tests!)

The alert code is tested via unit tests (nearly) as far as possible.

Fixes:

  • Extend marker check to cover alerts as well
  • Fix height check of CMPTxList::setLastAlert()
  • Only create class C transactions, if they are also accepted

Currently the payloads for alerts are pretty different from the other transaction types, and instead of using/parsing fields, it's basically a single string, which is later splitted.

This is something we might change at some point in my opinion.

@dexX7 dexX7 force-pushed the oc-0.10-cleanup-pulldown branch from d77da31 to 52d7ef1 Compare May 31, 2015 23:19
dexX7 added 7 commits June 1, 2015 01:29
This RPC command is intended for maintainers, or testing purposes.
An alert, which is mined in block 350000, should be active in block 350000, and not 350001.
Determines whether the sender is an authorized source for Omni Core alerts.

The option "-alertallowsender=source" can be used to whitelist additional sources,
and the option "-alertignoresender=source" can be used to ignore a source.

To consider any alert as authorized, "-alertallowsender=any" can be used. This
should only be done for testing purposes!
This has an effect on mainnet, but not testnet or regtest mode.
@zathras-crypto
Copy link

Reviewed - more great work - with HUGE thanks @dexX7 :)

Supported, merge when you're ready :)

@dexX7
Copy link
Member Author

dexX7 commented Jun 1, 2015

Thanks for the fast review! :)

A few quick questions:

In CheckExpiredAlerts() (case 4)

bool txLive = (chainActive.Height()>(int64_t) expiryValue);

Was chainActive.Height() intentionally used, or should it be curBlock?

Do you agree with -alertallowsender, -alertignoresender?

I'm very sure there will never be an option with this name for Bitcoin Core, but we might add an -omni before every option. On the other hand, -omnidebug and -omnilogfile are the only ones, while other options (such as -startclean) don't start with -omni either.

@zathras-crypto
Copy link

Was chainActive.Height() intentionally used, or should it be curBlock?

Well, the original intention was:
"is there a TX live on the network that the client doesn't support?"

I guess I didn't see much value to continuing to parse knowing that we would shutdown at some future stage of parsing. Eg if you're on mainnet with a synced up blockchain, but you download an old version of Omni Core, why waste the users time parsing up until curBlock > expiryValue and then shutting down, when we can shutdown as soon as we parse the alert message. Probably not too clear, let me try examples - assuming here user has a fully synced blockchain to block 400,000.

  • User downloads old version of Omni Core and starts parsing. They reach 350,000 and parse an alert that shows TX n goes live at block 399,999 and they don't support it. Client shuts down there and then.
  • User downloads old version of Omni Core and starts parsing. They reach 350,000 and parse an alert that shows TX n goes live at block 399,999 and they don't support it. Client continues parsing until block 399,999 and then shuts down.

The second scenario doesn't hold much value, it's just extra wasted time spent parsing since the end result is still the same (client can't be used).

I hope that makes sense :) I'm not super fussed though so if you have spotted a reason to use curBlock instead just shout I don't feel strongly about it.

I'm very sure there will never be an option with this name for Bitcoin Core, but we might add an -omni before every option

Yeah that's an interesting Q - I think it's kind of nice to make the distinction that these startup params affect the Omni code layer only so perhaps we should standardize on making all options prefixed with -omni even if it isn't explicitly required for avoiding collisions with Bitcoin Core.

Do you agree with -alertallowsender, -alertignoresender?

Yep, though in the context of above (ie perhaps -omnialertallowsender and friends).

@dexX7
Copy link
Member Author

dexX7 commented Jun 1, 2015

Ah, I see. Hm.. I mean, it's pretty unrealistic that there are very, very large gaps between the alert transaction and the expiry value. I tend to prefer to use curBlock, which feels more consistent (because the value is explicitly provided), and given that we're only talking about scanning for Omni transactions, there is probably also not a very huge waste of time.

In this context: we should show a warning earlier (as soon as possible), and use a shutdown as last resort, instead doing nothing while the alert is already processed, but not yet "expired". (edit: ah, I think this is already done)

I think it's kind of nice to make the distinction that these startup params affect the Omni code layer only so perhaps we should standardize on making all options prefixed ...

Agreed.

@dexX7
Copy link
Member Author

dexX7 commented Jun 1, 2015

Are those email addresses correct?

// Mainnet
16Zwbujf1h3v1DotKcn9XXt1m7FZn2o4mj  Craig   <craig@omni.foundation>
1MicH2Vu4YVSvREvxW1zAx2XKo2GQomeXY  Michael <michael@omni.foundation>
1zAtHRASgdHvZDfHs6xJquMghga4eG7gy   Zathras <zathras@omni.foundation>
1EXoDusjGwvnjZUyKkxZ4UHEf77z6A5S4P  Exodus (who has access?)

// Testnet
mpDex4kSX4iscrmiEQ8fBiPoyeTH55z23j  Michael <michael@omni.foundation>
mpZATHupfCLqet5N1YL48ByCM1ZBfddbGJ  Zathras <zathras@omni.foundation>

@zathras-crypto
Copy link

I tend to prefer to use curBlock

Sure, go ahead and make the change mate - as I say I'm not set on using chainHeight :)

edit: ah, I think this is already done

Yeah that's the way it's supposed to work, alert is parsed, message is displayed until the tx actually goes live, at which point state can't be trusted and shutdown occurs. Could probably do with more testing though (I think that about everything though hehe)

Are those email addresses correct?

AFAIK (assuming mastercoin.org > omni.foundation redirection is working) - though unsure for example if @m21 still checks his Omni email account.

Re who has access to Exodus - @CraigSellars can you please advise who has the key for Exodus?

@dexX7 dexX7 merged commit fddc6fc into OmniLayer:omnicore-0.0.10 Jun 1, 2015
dexX7 added a commit that referenced this pull request Jun 1, 2015
fddc6fc Rename options to "-omnialertallowsender", "-omnialertignoresender" (dexX7)
90cb49e Only create class C transactions, if they are also accepted (dexX7)
c48cd68 Whitelist dexX7 as source for Omni Core notifications (dexX7)
d60d0ef Add unit tests for Omni Core client notifications (dexX7)
cc50a35 Rename alert functions, provide return values by reference (dexX7)
f6663a8 Add CheckAlertAuthorization(), "-alertallowsender", "-alertignoresender" (dexX7)
e8e5989 Fix height check of CMPTxList::setLastAlert() (dexX7)
a999e29 Add hidden "sendalert_OMNI" command (dexX7)
4a0226e Extend marker check to cover alerts as well (dexX7)
a125b0c Support payload creation for alerts (dexX7)
4b77e41 Wrap alert code into namespace (dexX7)
c1d4d56 Fully enable/support reindexing (dexX7)
8ffccbd Remove wallet LOCK in ClassAgnosticWalletTXBuilder (dexX7)
e568acf Format some of the main functions (dexX7)
60ba692 Remove some old leftovers (dexX7)
aa1e62f Move actual code from header into sp.cpp (dexX7)
e0853f0 Push down xToString functions and friends (dexX7)
996831b Move MAX_SHA256_OBFUSCATION_TIMES to hasher (dexX7)
d815b26 Move alert/notification related code into seperated file (dexX7)
c932248 Move pending transactions related code into pending file (dexX7)
67e77c1 Remove unused code from omnicore.h/.cpp (dexX7)
@dexX7 dexX7 modified the milestone: 0.0.10.0 Dec 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants