mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Add validators sources
This commit is contained in:
@@ -24,13 +24,16 @@ namespace ripple
|
||||
{
|
||||
|
||||
#include "functional/ripple_Config.cpp"
|
||||
#include "functional/ripple_LoadFeeTrack.h" // private
|
||||
#include "functional/ripple_LoadFeeTrack.h" // private
|
||||
#include "functional/ripple_LoadFeeTrack.cpp"
|
||||
#include "functional/ripple_Job.cpp"
|
||||
#include "functional/ripple_JobQueue.cpp"
|
||||
#include "functional/ripple_LoadEvent.cpp"
|
||||
#include "functional/ripple_LoadMonitor.cpp"
|
||||
|
||||
#include "validator/ripple_Validator.cpp"
|
||||
#include "validator/ripple_Validators.cpp"
|
||||
|
||||
}
|
||||
|
||||
// These must be outside the namespace
|
||||
|
||||
@@ -37,6 +37,9 @@ namespace ripple
|
||||
/*.*/#include "functional/ripple_Job.h"
|
||||
/**/#include "functional/ripple_JobQueue.h"
|
||||
|
||||
#include "validator/ripple_Validator.h"
|
||||
#include "validator/ripple_Validators.h"
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
9
modules/ripple_core/validator/ripple_Validator.cpp
Normal file
9
modules/ripple_core/validator/ripple_Validator.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
Validator::Validator ()
|
||||
{
|
||||
}
|
||||
25
modules/ripple_core/validator/ripple_Validator.h
Normal file
25
modules/ripple_core/validator/ripple_Validator.h
Normal file
@@ -0,0 +1,25 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_VALIDATOR_H_INCLUDED
|
||||
#define RIPPLE_VALIDATOR_H_INCLUDED
|
||||
|
||||
/** Identifies a validator.
|
||||
|
||||
A validator signs ledgers and participates in the consensus process.
|
||||
*/
|
||||
class Validator
|
||||
{
|
||||
public:
|
||||
typedef RippleAddress PublicKey;
|
||||
|
||||
Validator ();
|
||||
|
||||
private:
|
||||
PublicKey m_publicKey;
|
||||
};
|
||||
|
||||
#endif
|
||||
46
modules/ripple_core/validator/ripple_Validators.cpp
Normal file
46
modules/ripple_core/validator/ripple_Validators.cpp
Normal file
@@ -0,0 +1,46 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
class ValidatorsImp
|
||||
: public Validators
|
||||
, private InterruptibleThread::EntryPoint
|
||||
{
|
||||
public:
|
||||
explicit ValidatorsImp (Listener* listener)
|
||||
: m_thread ("Validators")
|
||||
, m_listener (listener)
|
||||
{
|
||||
}
|
||||
|
||||
~ValidatorsImp ()
|
||||
{
|
||||
}
|
||||
|
||||
void addTrustedUri (String uri)
|
||||
{
|
||||
m_trustedUris.add (uri);
|
||||
}
|
||||
|
||||
void start ()
|
||||
{
|
||||
m_thread.start (this);
|
||||
}
|
||||
|
||||
void threadRun ()
|
||||
{
|
||||
// process the trustedUri list and blah blah
|
||||
}
|
||||
|
||||
private:
|
||||
InterruptibleThread m_thread;
|
||||
Listener* const m_listener;
|
||||
StringArray m_trustedUris;
|
||||
};
|
||||
|
||||
Validators* Validators::New (Listener* listener)
|
||||
{
|
||||
return new ValidatorsImp (listener);
|
||||
}
|
||||
36
modules/ripple_core/validator/ripple_Validators.h
Normal file
36
modules/ripple_core/validator/ripple_Validators.h
Normal file
@@ -0,0 +1,36 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_VALIDATORS_H_INCLUDED
|
||||
#define RIPPLE_VALIDATORS_H_INCLUDED
|
||||
|
||||
/** Maintains the list of chosen validators.
|
||||
|
||||
The algorithm for acquiring, building, and calculating metadata on
|
||||
the list of chosen validators is critical to the health of the network.
|
||||
|
||||
All operations are performed asynchronously on an internal thread.
|
||||
*/
|
||||
class Validators : Uncopyable
|
||||
{
|
||||
public:
|
||||
class Listener
|
||||
{
|
||||
public:
|
||||
//virtual void onValidatorsChosen (ValidatorList validators) { }
|
||||
};
|
||||
|
||||
public:
|
||||
static Validators* New (Listener* listener);
|
||||
|
||||
virtual ~Validators () { }
|
||||
|
||||
virtual void addTrustedUri (String uri) = 0;
|
||||
|
||||
virtual void start () = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user