File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
datdot-node/pallets/datdot/src Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -688,7 +688,19 @@ decl_module!{
688688 attestation: Attestation
689689 ) {
690690 let attestor = ensure_signed( origin) ?;
691- //TODO
691+ let attestor_index = <UserIndices <T >>:: get( attestor) ;
692+ let mut hosted_archive = <HostedMap >:: get( hoster_index, dat_index) ;
693+ let challenge = hosted_archive. state. get( & chunk_index) ;
694+ match challenge {
695+ Some ( Challenge :: Attesting ( ats) ) => {
696+ let mut attestations = ats. clone( ) ;
697+ attestations. completed. push( ( attestor_index, attestation) ) ;
698+ hosted_archive. state. insert( chunk_index, Challenge :: Attesting ( attestations) ) ;
699+ <HostedMap >:: insert( hoster_index, dat_index, hosted_archive) ;
700+ } ,
701+ _ => fail!( Error :: <T >:: InvalidChallenge ) ,
702+
703+ }
692704 }
693705
694706 #[ weight = ( 100000 , Operational , Pays :: No ) ] //todo weight
You can’t perform that action at this time.
0 commit comments