[blockchain] Simplify the architecture of blockchain traits
Instead of having two traits, `Blockchain` and `OnlineBlockchain` that need to be implemented by the user, only the relevant one (`OnlineBlockchain`, here renamed to `Blockchain`) will need to be implemented, since we provide a blanket implementation for the "marker" trait (previously `Blockchain`, here renamed to `BlockchainMarker`). Users of the library will probably never need to implement `BlockchainMarker` by itself, since we expose the `OfflineBlockchain` type that already does that and should be good for any "offline" wallet. Still, it's exposed since they might need to import it to define types with generics.
This commit is contained in:
@@ -63,7 +63,7 @@ pub fn magical_blockchain_tests(attr: TokenStream, item: TokenStream) -> TokenSt
|
||||
ReturnType::Type(_, ref t) => t.clone(),
|
||||
ReturnType::Default => {
|
||||
return (quote! {
|
||||
compile_error!("The tagged function must return a type that impl `OnlineBlockchain`")
|
||||
compile_error!("The tagged function must return a type that impl `Blockchain`")
|
||||
}).into();
|
||||
}
|
||||
};
|
||||
@@ -79,7 +79,7 @@ pub fn magical_blockchain_tests(attr: TokenStream, item: TokenStream) -> TokenSt
|
||||
|
||||
use testutils::{TestClient, serial};
|
||||
|
||||
use #root_ident::blockchain::{OnlineBlockchain, noop_progress};
|
||||
use #root_ident::blockchain::{Blockchain, noop_progress};
|
||||
use #root_ident::descriptor::ExtendedDescriptor;
|
||||
use #root_ident::database::MemoryDatabase;
|
||||
use #root_ident::types::ScriptType;
|
||||
|
||||
Reference in New Issue
Block a user