File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,17 +37,6 @@ func NewEntry() *Entry {
3737 return e
3838}
3939
40- func ValidateRevealEntryChainID (e * Entry ) error {
41- if e == nil {
42- return fmt .Errorf ("No entry provided" )
43- }
44- expectedChainID := NewChainID (e )
45- if ! expectedChainID .IsSameAs (e .ChainID ) {
46- return fmt .Errorf ("Invalid ChainID." )
47- }
48- return nil
49- }
50-
5140// NewChainID generates a ChainID from an entry. ChainID = Sha(Sha(ExtIDs[0]) +
5241// Sha(ExtIDs[1] + ... + Sha(ExtIDs[n]))
5342func NewChainID (e * Entry ) * Hash {
Original file line number Diff line number Diff line change @@ -566,6 +566,12 @@ func processRevealEntry(msg *wire.MsgRevealEntry) error {
566566 fMemPool .addOrphanMsg (msg , h )
567567 return fmt .Errorf ("Credit needs to paid first before an entry is revealed: %s" , e .Hash ().String ())
568568 }
569+
570+ //validate chain id for the first entry
571+ expectedChainID := common .NewChainID (e )
572+ if ! expectedChainID .IsSameAs (e .ChainID ) {
573+ return fmt .Errorf ("Invalid ChainID for entry: %s" , e .Hash ().String ())
574+ }
569575
570576 //validate chainid hash in the commitChain
571577 chainIDHash := common .DoubleSha (e .ChainID .Bytes ())
Original file line number Diff line number Diff line change @@ -201,14 +201,6 @@ func handleRevealEntry(ctx *web.Context) {
201201 }
202202 }
203203
204- err := common .ValidateRevealEntryChainID (entry )
205- if err != nil {
206- wsLog .Error (err )
207- ctx .WriteHeader (httpBad )
208- ctx .Write ([]byte (err .Error ()))
209- return
210- }
211-
212204 if err := factomapi .RevealEntry (entry ); err != nil {
213205 wsLog .Error (err )
214206 ctx .WriteHeader (httpBad )
You can’t perform that action at this time.
0 commit comments